Tuesday, August 14, 2012

Direct Apache access to SSL ports

Secure Socket Layer (SSL) provides an encrypted network connection and is seen to use the HTTPS protocol in the URL. To ensure that the web server only servers HTTPS, the following needs to be enabled before the HTTPS VirtualHost tag.



RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}:443%{REQUEST_URI}


What it means? turn off https if its https, then change the url to always use https.

Actually, you can put a lot more between the VirtualHost tag. E.g. choice of error pages to server and limiting which domain/IP address that can access the contents.

No comments:

Blog Archive