Search code examples
http-redirecthttpswebsphere

WebSphere, sendRedirect and HTTPS


Environment: WebSphere App Server / WebSphere Portal 7, fronted by IBM IHS/Apache httpd using was_ap20_module / mod_was_ap20_http.

I have a servlet or JSP page with a redirect like

response.sendRedirect("/wps/myportal/....")

The generated HTTP ends up with the right host and port for the IHS/Apache endpoint but the wrong protocol. It is http instead of https.

For example, if IHS/Apache is listening on https://myserver.com and WAS is on http://192.168.12.34:12345 (all ports/hosts fake), then my redirect comes back as http://myserver.com - correct host and port but wrong protocol.

How does WebSphere figure out the right host/port to use but not the protocol? How can I force the desired behavior?


Solution

  • Add Apache mod_headers to add a custom header before the request is forwarded to websphere, in websphere, set the httpsIndicatorHeader to that custom header, then websphere will know to switch to https

    http://www.ibmconnections.org/wordpress/index.php/tag/was-ssl-http-https/ http://pic.dhe.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=%2Fcom.ibm.websphere.express.doc%2Finfo%2Fexp%2Fae%2Frweb_custom_props.html