Centos – Forward proxy requests through ssl in apache

apache-2.2centos

I have an apache webserver and I want to forward proxy all requests to another domain. so far, I've done that for http requests but it does not work for https. my httpd-ssl.conf file:

Listen 443 
AddType application/x-x509-ca-cert .crt 
AddType application/x-pkcs7-crl .crl 
SSLPassPhraseDialog builtin 
SSLSessionCache shmcb:/var/log/httpd/ssl_scache(512000) 
SSLSessionCacheTimeout 300 
SSLProxyEngine On 
SSLProxyVerify require 
SSLProtocol All -SSlv2 -SSLv3 
ProxyRequests Off 
ProxyPreserveHost On 

<VirtualHost _default_:443> 
 ServerName domain.com 
 ServerAdmin webmaster@domain.com 
 DocumentRoot /path 

 ProxyRequests Off 
 ProxyPreserveHost On 

 SSLEngine On 
 SSLProxyEngine On 
 SSLHonorCipherOrder On 
 SSLCipherSuite -- 
 SSLCertificateFile /path/server.crt 
 SSLCertificateKeyFile /path/server.key 
 SSLCACertificateFile /path/server.ca 

#<Proxy *> 
# Order allow,deny 
# Allow from all 
#</Proxy> 

 <Location / > 
  ProxyPass "http://my.ip/" 
  ProxyPassReverse "http://my.ip/" 
 </Location> 
</VirtualHost>

when I go to http://example.com/v1, it forwards request to http://my.ip/v1 , but when I go to same url using https (https://example.com/v1) it just opens my index.html in root directory and does not forward request.

Best Answer

And add this to your VirtualHost config:

SSLProxyEngine on

You can also using ProxyPass command in plain VirtualHost section.

Section

<Location />
  ...
</Location>

is unnecessary.

Related Topic