Redirect port / port 10000 to https apache

Posted by Hamid Elaosta on Server Fault See other posts from Server Fault or by Hamid Elaosta
Published on 2011-11-12T14:32:11Z Indexed on 2011/11/12 17:55 UTC
Read the original article Hit count: 277

Filed under:
|
|

I have been reading around and trying different configurations to get a request to my server on port 10000 to redirect a http to a https request.

For some reason I can't figure out how to make it happen when i use port 10000 although i can set a rewrite rule for port 80 (implicit) to do it:

All I want is a request as follows:

http://127.0.0.1:10000

to redirect me to

https://127.0.0.1:10000

but it needs to be written so that it also works when accessed via my domain name externally.

My current, vhost, the last of many different attempts is currently set as follows, but it doesn't seem to work at all:

<VirtualHost *:10000>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_POST}%{REQUEST_URI}

ErrorLog "/var/log/httpd/webmin-redirect_error_log.log"
CustomLog "/var/log/httpd/webmin-redirect_access_log.log" common
</VirtualHost>

I'v also tried a few other things but nothing seems to work, any help would be appreciated.

EDIT: I already have a re-write in my httpd.conf that redirects port 80 to https. If I access port 10000 externally it is redirected to https, but from the lan "http://192.168.0.2:10000" it doesnt.

© Server Fault or respective owner

Related posts about apache2

Related posts about virtualhost