Jersey client: problem with http header field 'host'

Hi there,

I’m currently developing a Confluence 6.0.1 Server Add-On which includes the possibility of directing requests to remote REST endpoints. The requests are sent using the jersey rest client. The version of the jersey-client maven dependency is 1.8-atlassian-16.

I’ve been trying to test this functionality using requestb.in. Unfortunately requestb.in has been responding to my requests with 403 (forbidden), whereas a simple request with curl worked just fine. To debug this problem I inspected the requests that my add-on creates with a service on my local machine and then I tried to reproduce the problem using curl.

I found out that the culprit seemed to be the ‘host’ header field, which is apparently set by Jersey. When I set the header field using curl, I also get a 403, no matter what value I assign to it. I found out that the ‘host’ header field is not supposed to be set with http2 - could that be the problem? If so: how could I prevent jersey from setting it? If not: Any idea how to solve this? I’ll happily provide more information if needed.

To clarify: My primary concern isn’t to make requests to requestb.in, I can also test with a service on my local machine. Rather than that I am concerned that whatever prevents me from making requests to requestb.in might also break requests to other services.

Thank you for reading!
Claudio