How to solve this strange network problem with Application Linking?
Asked by Harm Endres:

Hello, everyone,

we have a problem linking Jira and Confluence. Confluence can reach Jira and vice versa. Jira and Confluence run inside Docker and have also imported the internal root CA in the keystore. As reverse proxy we use HAProxy.

We get the following error in the log:

```
2020-06-19 06:27:55,097 WARN [http-nio-8090-exec-2] [atlassian.applinks.core.DefaultApplinkStatusService] logApplinkError Network error while attempting to retrieve status of Application Link 'b67d7df8-412a-3ec8-b734-c4db6df9558c'
-- referer: https://confluence.example.com/plugins/servlet/applinks/listApplicationLinks | url: /rest/applinks/3.0/status/b67d7df8-412a-3ec8-b734-c4db6df9558c | traceId: 2a4824a5174a4888 | userName: harm
2020-06-19 06:27:55,098 DEBUG [http-nio-8090-exec-2] [atlassian.applinks.core.DefaultApplinkStatusService] visit 'b67d7df8-412a-3ec8-b734-c4db6df9558c' error type: UNEXPECTED_RESPONSE
2020-06-19 06:27:55,098 DEBUG [http-nio-8090-exec-2] [atlassian.applinks.core.DefaultApplinkStatusService] visit 'b67d7df8-412a-3ec8-b734-c4db6df9558c' response status: 200: OK
2020-06-19 06:27:55,099 DEBUG [http-nio-8090-exec-2] [atlassian.applinks.core.DefaultApplinkStatusService] visit 'b67d7df8-412a-3ec8-b734-c4db6df9558c' response content type: application/json
2020-06-19 06:27:55,099 DEBUG [http-nio-8090-exec-2] [atlassian.applinks.core.DefaultApplinkStatusService] visit 'b67d7df8-412a-3ec8-b734-c4db6df9558c' response contents

{"consumers":[{"key":"Confluence:4880970436","name":"Confluence","description":"Atlassian Confluence at https://confluence.example.com ","signatureMethod":"RSA_SHA1","publicKey":"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAgqGX5LH2Z+eZuGkTGyKTdBGrdSaia8ploM1VPnBLxaSLg3JMJB8jvj98dnjfWL4y6qMHJb/4/YJkPLgVzUj4TT+ogJB/jTCUaQcMQHPFkuOf62W/u9cz58m7jfLSb5Z03asobdo7uc70/450gg11V8n/RfbF/sUNDOApSMVoUccTjYG6THw88PT0+QWxaNkXF4afjkH+U/H5+MmtoqBuOJQ/XstcATqhhlrGr3R32cCjogWtuM89TU6SsnNxleBUmu8dAW/ulR (...)


2020-06-19 06:27:55,099 DEBUG [http-nio-8090-exec-2] [atlassian.applinks.core.DefaultApplinkStatusService] logApplinkError Network error trace for 'b67d7df8-412a-3ec8-b734-c4db6df9558c'
-- referer: https://confluence.example.com/plugins/servlet/applinks/listApplicationLinks | url: /rest/applinks/3.0/status/b67d7df8-412a-3ec8-b734-c4db6df9558c | traceId: 2a4824a5174a4888 | userName: harm
com.atlassian.applinks.internal.status.remote.ResponseApplinkStatusException
at com.atlassian.applinks.internal.status.error.NetworkErrorTranslator$ResponseContentMatcher.createMatchingError(NetworkErrorTranslator.java:249)
at com.atlassian.applinks.internal.status.error.NetworkErrorTranslator.toApplinkErrorException(NetworkErrorTranslator.java:82)
at com.atlassian.applinks.internal.status.oauth.remote.DefaultRemoteOAuthStatusService.fetchOAuthStatus(DefaultRemoteOAuthStatusService.java:86)
at com.atlassian.applinks.core.DefaultApplinkStatusService.getApplinkStatus(DefaultApplinkStatusService.java:96)
at com.atlassian.applinks.internal.rest.status.ApplinkStatusResource.getStatus(ApplinkStatusResource.java:105)
at jdk.internal.reflect.GeneratedMethodAccessor2550.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at com.atlassian.plugins.rest.common.interceptor.impl.DispatchProviderHelper$ResponseOutInvoker$1.invoke(DispatchProviderHelper.java:192)
at com.atlassian.plugins.rest.common.interceptor.impl.DispatchProviderHelper$1.intercept(DispatchProviderHelper.java:83)
at com.atlassian.plugins.rest.common.interceptor.impl.DefaultMethodInvocation.invoke(DefaultMethodInvocation.java:53)
at com.atlassian.applinks.internal.rest.interceptor.NoCacheHeaderInterceptor.intercept(NoCacheHeaderInterceptor.java:13)
at com.atlassian.plugins.rest.common.interceptor.impl.DefaultMethodInvocation.invoke(DefaultMethodInvocation.java:53)
at com.atlassian.applinks.internal.common.rest.interceptor.RestRepresentationInterceptor.intercept(RestRepresentationInterceptor.java:31)
at com.atlassian.plugins.rest.common.interceptor.impl.DefaultMethodInvocation.invoke(DefaultMethodInvocation.java:53)
at com.atlassian.applinks.internal.rest.interceptor.ServiceExceptionInterceptor.intercept(ServiceExceptionInterceptor.java:28)
at com.atlassian.plugins.rest.common.interceptor.impl.DefaultMethodInvocation.invoke(DefaultMethodInvocation.java:53)
at com.atlassian.applinks.core.rest.context.ContextInterceptor.intercept(ContextInterceptor.java:16)
at com.atlassian.plugins.rest.common.interceptor.impl.DefaultMethodInvocation.invoke(DefaultMethodInvocation.java:53)
at com.atlassian.plugins.rest.common.interceptor.impl.DispatchProviderHelper.invokeMethodWithInterceptors(DispatchProviderHelper.java:110)
at com.atlassian.plugins.rest.common.interceptor.impl.DispatchProviderHelper$ResponseOutInvoker._dispatch(DispatchProviderHelper.java:190)
at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302)
at 
... max chars
Caused by: java.lang.NullPointerException
at com.atlassian.plugins.rest.module.jersey.JerseyEntityHandler.unmarshall(JerseyEntityHandler.java:203)
at com.atlassian.plugins.rest.module.jersey.JerseyResponse.getEntity(JerseyResponse.java:41)
at com.atlassian.applinks.internal.status.oauth.remote.ApplinkAuthenticationOAuthFetchStrategy$ApplinkAuthenticationOAuthStatusHandler.handle(ApplinkAuthenticationOAuthFetchStrategy.java:160)
... 342 more

```

Best regards and thanks in advance  
Harm


Answers:
author: Olivier Voortman
body: It's a bug in the Atlassian products. Their HTTP client implementation is not HTTP/1.1 compliant and rely on HTTP header case.

There is a bug reported here that should get more priority <https://jira.atlassian.com/browse/JRASERVER-70602>


author: Nic Brough -Adaptavist-
body: I seem to remember this happening on one of my machines a while ago - it was down to the spelling error I had in the "Reverse Proxy" line in my Apache config (my proxy line was right, the reverse proxy not). Could there be a problem with the reverse proxying being done by the HA proxy?

comments: author: Harm Endres
body: I'm not sure but looks like the request is handled correctly, since it is answered with 200, but the answer(payload) seems not to be the expected.

It turns out the linking itself works, it is only the status in the administration page.


author: Olivier Voortman
body: We have the same setup (docker containers + HAProxy with SSL) and application links are not working .

How can you test if the status is not right?


author: Nic Brough -Adaptavist-
body: I got the 200 error as well, when the reverse proxy part was wrong. I can't tell you how to fix your proxy.


author: Harm Endres
body: In the administration under "Administration" -\> "Application Links". It has been working in the past(the link check). This might be related to a network change on the Docker Host, which would not make sense since Confluence and Jira are on the same host.

But as mentioned the link between Jira and Confluence seems to work. We can use for example the Jira Macro in Confluence.

![2020-06-23_13-48.png](https://community.atlassian.com/t5/image/serverpage/image-id/100050iF72DF9C58ECC587C/image-size/large?v=v2&px=999 "2020-06-23_13-48.png")


Tags: confluence-server

server