2

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 ?

1
  • AFAIK, the parameters you mention: -Dhttps.proxyHost and -Dhttps.proxyPort are used to stablish the "forward" proxy of your organisation and have nothing to do with the reverse proxy configured in Apache
    – Pedro
    Oct 28, 2021 at 7:48

3 Answers 3

2

Solved this problem by following below steps.

  1. Add following in Apache web server's virtual host tag . What you actually need is to forward along the protocol that was used to access the server.

    VirtualHost *:443> RequestHeader set X-Forwarded-Proto "https" …. /VirtualHost>

For more explanation refer site https://www.nczonline.net/blog/2012/08/08/setting-up-apache-as-a-ssl-front-end-for-play/

  1. Following properties needs be added in Websphere webcontainer properties through admin console. Go to Application servers > server1 > Web container > Custom properties Add Following properties

httpsIndicatorHeader - X-Forwarded-Proto (Request header value set in web server (in our case it is https) )

com.ibm.ws.webcontainer.extractHostHeaderPort - true (To obey request port no)

trusthostheaderport - true (To obey request port no)

Refered the below site for this settings

http://www-01.ibm.com/support/docview.wss?uid=swg21569667

http://129.33.205.81/support/knowledgecenter/SSEQTP_8.5.5/com.ibm.websphere.base.iseries.doc/ae/rweb_custom_props.html

1

I assume that you are using like below

response.sendRedirect(request.getContextPath() + "/my/main.jsp");

Here - request.getContextPath gives the proxied server info.

As a quick fix I resolved it using the proxy server values from properties files.

response.sendRedirect("get proxy server name from prop file" + "/my/main.jsp");

1
  • Yes I have tried this solution already and it is working but I want server side settings/configuration for acheving this. Thank you for your help. Nov 10, 2015 at 5:55
0

In our case (Websphere Liberty 21.0.0.9), we simply added a couple of directives in the corresponding Apache virtual host configuration:

  • RequestHeader set X-Forwarded-Proto "https"
  • ProxyPreserveHost On`

These directives are valid only from Apache 2.3.3 on

Both are mentioned in the article mentioned below by @Darshan Shah

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.