Apache ReverseProxyPass redrects to http rather than https
5,031
ProxyPassReverse
can not fix this kind of redirections. There are 2 ways to solve the problem:
- Use HTTPS for the internal site. e.g.
ProxyPass / https:...
andProxyPassReverse / https:
(actually the last one is not required in your case). - Use mod_headers in the reverse proxy:
Header edit Location ^http: https:
- Use mod_rewrite in the reverse proxy to change the redirection.
Related videos on Youtube
Author by
Paul
Updated on September 18, 2022Comments
-
Paul almost 2 years
I have a reverse proxy setup using apache mod_proxy:
<VirtualHost *:443> ServerName reverse.server.com ProxyPass / http://10.1.9.11:3000/ ProxyPassReverse / http://10.1.9.11:3000/ ProxyPreserveHost on ...snip ssl stuff... </VirtualHost>
This works fine most of the time. The problem is when the internal server does a redirect. While the proxypassreverse should catch the location, and it seems to, it redirects to http://reverse.server.com rather than to https://reverse.server.com. So it is half working, the address changes correctly, but the protocol stays as the internal server.
I am not clear on why it is doing this, as the proxied connection is SSL - any ideas?
-
Paul about 12 yearsAh, so this would send http to the browser, I would need to accept http inbound and change to https? Currently this server is only listening on 443. Is there another way?
-
Mircea Vutcovici about 12 yearsYes, to use HTTPS internally.
-
myrdd almost 5 yearsfwiw,
httpsIndicatorHeader
is documented here: ibm.com/support/knowledgecenter/en/SSKTXQ_9.0.0/admin/config/… -
Doug McLean about 4 yearsThank you so much :) using
Header edit
solved it for me. This had been driving me mad!