javawebspherereverse-proxy

Websphere not directing request to proxy server on response.sendRedirect


I have secured apache reverse proxy configured in front of my websphere 8 application server. I have set generic JVM arguments -Dhttps.proxyHost and -Dhttps.proxyPort but the requests on response.sendRedirect are not directed to peoxy server. It is directed to defualt port 9080. How to solve this issue ? I have solved this issue on Tomcat & Jboss by modifying my connector port as follows

connector name="http" protocol="HTTP/1.1" socket-binding="http" scheme="https" proxy-name=" 192.168.1.1 " proxy-port="443" secure="true"

How do I solve this for Websphere ?


Solution

  • In our case, with Liberty being behind Integrated Web Services for IBM i (IWS) and running on a different port, we did not have an option to add

    com.ibm.ws.webcontainer.extractHostHeaderPort -true
    trusthostheaderport - true
    

    Our only option, based on Open Liberty documentation, was to add following headers at the reverse proxy

    X-Forwarded-Proto: https
    X-Forwarded-Port: 443
    

    As well as setting it to preserve the host in X-Forwarded-Host header. This is achieved using ProxyPreserveHost On on Apache mod-proxy, but others might do it by default.

    Apache mod proxy configuration

    RequestHeader set X-Forwarded-Proto "https"
    RequestHeader set X-Forwarded-Port "443"
    ProxyPreserveHost On