Justin
Justin

Reputation: 887

Apache Reverse Proxy https to http

I've done a fair amount of browsing on here and the Internet but I can't configure my apache to reverse proxy https to http. I feel like I'm close however. All the examples I've followed seem to work for everyone except me and my setup is very simple.

<VirtualHost *:443>
ServerName myserver
SSLEngine On
SSLCertificateFile /path/to/file
SSLCertificateKeyFile /path/to/file
SSLCertificateChainFile /path/to/file
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
    AddDefaultCharset Off
    Order deny,allow
    Allow from all
</Proxy>
ProxyPass / http://myserver:8081/
ProxyPassReverse / http://myserver:8081/

ErrorLog logs/myserver-error_log
CustomLog logs/myserver-access_log common
</VirtualHost>

So when I go to https://myserver/ I expect it to redirect to that port which is running Nexus.

Before I did SSL this was actually working for a VirtualHost *:80. I could go to http://myserver/ and end up at Nexus. Not sure why https is not working.

What's actually happening is https://myserver/ goes to https://myserver and displays a test index.html I have setup in the DocumentRoot.

Upvotes: 7

Views: 45598

Answers (1)

Justin
Justin

Reputation: 887

Turns out something funky was going on in with 443 port.

httpd was listening on that port, a nmap command from another machine showed 443 open but for some reason, however the VM of RHEL 7 was setup, it wasn't working.

So I switched ports and below is the configuration that eventually got my reverse proxy to https into apache and http to my Nexus repo.

Nexus returns a webpage with http links that break getting the content for that page but I only need the SSL for a docker daemon which won't be asking for webpages.

Listen 8082
<VirtualHost *:8082>
ServerName myserver
SSLEngine On
SSLCertificateFile /path/to/file
SSLCertificateKeyFile /path/to/file
SSLCertificateChainFile /path/to/file
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
AddDefaultCharset Off
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://myserver:8081/
ProxyPassReverse / http://myserver:8081/

ErrorLog logs/myserver-error_log
CustomLog logs/myserver-access_log common
</VirtualHost>

Upvotes: 5

Related Questions