Use apache as a HTTPS to HTTP Proxy
I'm trying to configure Apache on Centos 6 to proxy and reverse proxy traffic to an http server of a third party provider.
The setup should work like this:
https://mydomain.com/proxy/
proxies all trafic transparently to
http://thirdparty.com/app/
The issue I'm having is any request made to https://mydomain.com/proxy/
gets a 301 redirect in response.
These are all of the proxy related options in my VirtualHost
SetOutputFilter proxy-html
ProxyHTMLExtended On
ProxyRequests Off
SSLProxyEngine On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /proxy/ http://thirdparty.com/app/
<Location /proxy/>
ProxyPassReverse /
ProxyHTMLEnable On
ProxyHTMLURLMap http://thirdparty.com/app/ /proxy/
ProxyHTMLURLMap / /proxy/
</Location>
Solution 1:
We have a similar setup and are using this (of course you need to load before mod_proxy, mod_ssl and mod_proy_http):
ProxyRequests Off
# SSLProxyEngine On # only required if the proxied service would be HTTPS as well
# Meaning if we would reverse proxy https://thirdparty.com/app/
# Thanks @Piskvor for the clarification.
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /proxy/ http://thirdparty.com/app/
ProxyPassReverse /proxy/ http://thirdparty.com/app/
<Location /proxy/>
ProxyPassReverse /
Order deny,allow
Allow from all
</Location>
Header edit Location ^http://thirdparty.com/app/ https://thirdparty.com/app/