Mobile app version of vmapp.org
Login or Join
Courtney195

: How to hide/proxy port 8080 via HTTPS/443 with Apache? I have a non-encrypted service running separate to apache on 8080. I'd like to hide it and redirect all traffic to it via SSL. I have

@Courtney195

Posted in: #Apache #Https #Proxy

I have a non-encrypted service running separate to apache on 8080. I'd like to hide it and redirect all traffic to it via SSL.

I have successfully setup proxy/reverse proxy so all requests to example.com go to port 8080.

However, I can still directly access the service if I go to example.com:8080. And it goes via http, not https. I can't block that with the firewall, since the service includes some of the links in the form www.example.com:8080. I have tried adding a virtualhost on :8080 and listen on 8080 but that doesn't work (and also breaks the proxy on *:443).

Could anyone suggest what I am doing wrong?
All services run on the same ip address.

<VirtualHost *:80>
ServerName example.com
ServerAlias example.com Redirect permanent / www.example.com/ </VirtualHost>

<VirtualHost *:8080>
ServerName example.com:8080
ServerAlias example.com:8080 Redirect permanent / www.swapsk.in:443/ </VirtualHost>

NameVirtualHost *:443
<VirtualHost *:443>
ServerName example.com
ServerAlias example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html

SSLEngine on
SSLCertificateFile /root/cert.crt
SSLCertificateKeyFile /root/key.key
SSLCACertificateFile /root/ca.ca-bundle

ProxyRequests Off
ProxyPreserveHost On
AllowEncodedSlashes NoDecode
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /phpmyadmin !
ProxyPassReverse /phpmyadmin !
ProxyPass / localhost:8080/ nocanon
ProxyPassReverse / localhost:8080/ ProxyPassReverse / www.example.com/ RequestHeader set X-Forwarded-Proto "https"
RequestHeader set X-Forwarded-Port "443"

</VirtualHost>

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Courtney195

1 Comments

Sorted by latest first Latest Oldest Best

 

@Cofer257

Do an URL rewrite - so that requests to anywhere on http are redirected to the same address/port on https:

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) %{SERVER_NAME}/ [R,L]

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme