Details
-
Bug
-
Resolution: Not a bug
-
Low
-
None
-
7.2.6
-
7.02
-
3
-
Severity 3 - Minor
-
1
-
Description
Summary
The BaseUrlHealthCheck will fail when the environment goes through more than 3 redirects. This can happen with complex proxies or some plugins such as SAML authentication that goes through multiple redirections.
Steps to Reproduce
- Set up a JIRA instance with multiple redirections (e.g. set up SAML with redirection)
- Run the JIRA health check
Expected Results
The base URL is configured properly, so the test passes
Actual Results
The below exception is thrown in the atlassian-jira.log file:
2017-01-09 16:27:47,254 SupportHealthCheckThread-5 ERROR ServiceRunner [c.a.j.p.healthcheck.support.BaseUrlHealthCheck] An error occurred when performing the Base URL healthcheck: org.apache.http.client.ClientProtocolException at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:186) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:107) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55) at com.atlassian.jira.plugins.healthcheck.support.BaseUrlHealthCheck.doCheck(BaseUrlHealthCheck.java:52) at com.atlassian.jira.plugins.healthcheck.support.AbstractSupportHealthCheck.check(AbstractSupportHealthCheck.java:27) at com.atlassian.support.healthcheck.impl.PluginSuppliedSupportHealthCheck.check(PluginSuppliedSupportHealthCheck.java:41) at com.atlassian.support.healthcheck.concurrent.SupportHealthCheckTask.run(SupportHealthCheckTask.java:33) at com.atlassian.support.healthcheck.concurrent.SupportHealthCheckProcess.run(SupportHealthCheckProcess.java:43) at com.atlassian.support.healthcheck.thread.HealthCheckProcessCallable.call(HealthCheckProcessCallable.java:44) at com.atlassian.support.healthcheck.thread.HealthCheckProcessCallable.call(HealthCheckProcessCallable.java:20) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: org.apache.http.client.RedirectException: Maximum redirects (3) exceeded
Notes
The BaseUrlHealthCheck.java class in the jira-healthcheck-plugin is hardcoding the value to 3 (setMaxRedirects(3)), which is not adequate for all customers:
private HttpClient newHttpClient() { SocketConfig socketConfig = SocketConfig.custom().setSoTimeout(DEFAULT_CONNECT_TIMEOUT_MS).build(); HttpClientBuilder httpClientBuilder = HttpClientBuilder.create(); SystemDefaultRoutePlanner routePlanner = new SystemDefaultRoutePlanner(ProxySelector.getDefault()); httpClientBuilder.setRoutePlanner(routePlanner); httpClientBuilder.setDefaultSocketConfig(socketConfig); httpClientBuilder.setDefaultHeaders( ImmutableSet.of(new BasicHeader("Accept-Encoding", "gzip, deflate")) ); RequestConfig.Builder requestConfigBuilder = RequestConfig.custom().setMaxRedirects(3); httpClientBuilder.setDefaultRequestConfig(requestConfigBuilder.build()); return httpClientBuilder.build(); } }
Diagnosis
If you run the httpclienttest that is used by this class, you will notice the connection is successful but there are more than 3 redirections happening. This causes the check to fail.
grep -c "Redirect requested" /Users/ajean/Desktop/http-client-test.out
4
In this specific case, since the number is above 3, it will cause the check to fail even though the base URL is correct.
Workaround
Remove complex redirections from the environment (not optimal)
Attachments
Issue Links
- relates to
-
JRASERVER-63795 The JIRA Base URL Healthcheck can fail in certain SSO/SAML scenarios despite the gadgets URL working correctly
- Closed