-1

Im trying to config a reverse proxy server (Centos 7). The virtual host configuration as below:

 <VirtualHost *:443>
  ServerName www.example2.com
  ServerAlias example2.com

  ProxyPass / https://keycdn.com/
  ProxyPassReverse / https://keycdn.com/

  SSLEngine on
  SSLProxyEngine on

  SSLCertificateFile /etc/ssl/certs/apache-selfsigned.crt
  SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key

  ErrorLog /var/log/httpd/example.com-error.log
  CustomLog /var/log/httpd/example.com-access.log combined
 </VirtualHost>

It is always do redirect to the actual URL rather than working as reverse-proxy, but working well for http site :

ProxyPass / http://example.com/
ProxyPassReverse / http://example.com/

Anybody can enlighten me on what should I do to able doing ProxyPass/ProxyPassReverse for HTTPS. Thanks.

[EDIT]

It always reply 301-Moved Permanently for https proxypass.

  • What do you see in /var/log/httpd/example.com-access.log when you try it? – Gerard H. Pille Apr 28 '18 at 9:32
  • It is normal log: S X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36" 192.168.1.129 - - [28/Apr/2018:16:13:59 +0800] "GET / HTTP/1.1" 301 178 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36" – zainoz.zaini Apr 28 '18 at 9:38
  • Please edit into the question the output of curl -v https://www.example2.com – kubanczyk Apr 28 '18 at 9:38
  • So you got a redirect. Not from this config, perhaps from keycdn.com? Where did it send you to? cfr the Location header. – Gerard H. Pille Apr 28 '18 at 9:41
  • @GerardH.Pille - its redirect me to the keycdn.com. If I set the url to example.com, it rendering the example.com content but on the proxy ip. – zainoz.zaini Apr 28 '18 at 9:49
0

You're probably missing:

ProxyPreserveHost On

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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