title: JAX RS injected URIInfo returning localhost for REST requests in reverse proxy
body: <p>I have a set of IBM Websphere Liberty profiles servers inside a HAProxy reverse proxy. Everything works ok but HAProxy is doing something on requests so I can't get the correct URL in the requests using <code>uriInfo.getBaseUri()</code> or <code>uriInfo.getRequestUriBuilder().build(&quot;whatever path&quot;)</code>... they both return localhost:9080 as host and port, so I can't build correct URLs pointing to the service. (The request is a standard <a href="http://api.MYHOST.com/v1/.." rel="nofollow noreferrer">http://api.MYHOST.com/v1/..</a>. REST request )</p>
  <p>Of course, I get a <code>uriInfo</code> object using <code>@Context</code> in the method so it gets the request information.</p>
  <p>Front end configuration:</p>
  <pre><code>  reqadd X-Forwarded-Proto:\ http
    # Add CORS headers when Origin header is present
    capture request header origin len 128
    http-response add-header Access-Control-Allow-Origin %[capture.req.hdr(0)] if { capture.req.hdr(0) -m found }
    rspadd Access-Control-Allow-Methods:\ GET,\ HEAD,\ OPTIONS,\ POST,\ PUT  if { capture.req.hdr(0) -m found }
    rspadd Access-Control-Allow-Credentials:\ true  if { capture.req.hdr(0) -m found }
    rspadd Access-Control-Allow-Headers:\ Origin,\ X-Requested-With,\ Content-Type,\ Accept  if { capture.req.hdr(0) -m found }
  </code></pre>
  <p>And Back-end configuration is:</p>
  <pre><code>  option forwardfor
    http-request set-header Host api.MYHOST.com
    http-request set-header X-Forwarded-Host %[dst]
    http-request set-header X-Forwarded-Port %[dst_port]
  </code></pre>
  <p>Any ideas on how to get the real request?</p>