Ssl – Mod_proxy preserve request protocol

apache-2.2mod-proxyssl

I have an apache reverse proxy server with two balancer members – one for non-secure and one for secure. I want to 'reverse' the request to the machine inside the firewall using the original protocol. As far as I can tell, lines like:

ProxyPassMatch (?i)^/mydir(.*)$ balancer://ags-lb-NS/mydir/$1 
ProxyPassReverse /mydir balancer://ags-lb-NS/mydir

leave no room for the original request protocol.
Or perhaps there is something I could add the to the header that could be detected on the inside machine.

Best Answer

Couldn't figure out how to proxypass based on an env variable such as %{HTTPS} but did figure out that I could add a custom header to look for in code running on the inside machine:

RequestHeader append X-FORWARD-HTTPS %{HTTPS}e 

<Proxy balancer://ags-lb>
#  BalancerMember https://secureserver
BalancerMember https://server1
SetEnv force-proxy-request-1.0 1
SetEnv proxy-nokeepalive 1
</Proxy>

# ---------------------- Non-Secure loadbalancer pool
<Proxy balancer://ags-lb-NS>
#  BalancerMember http://nonsecureserver
BalancerMember http://server2
SetEnv force-proxy-request-1.0 1
SetEnv proxy-nokeepalive 1
</Proxy>