Force HTTPS, easily

2004-09-21 13:24 - Tech

I recently set up a service monitoring package on my home server. By the way, it's Nagios which is hard to set up the first time, but a very powerful very cool program. This thing is available over the web, and I set up basic authentication to protect it. Problem is I wanted to encrypt the connection to protect my password.

I realized there's a very easy way to have Apache take any regular http request and tell the client to do https instead. It's as easy as:

<VirtualHost *:80>
  ServerName www.domain.com

  RewriteEngine On
  RewriteRule ^.*$ https://www.domain.com/ [R,L]
</VirtualHost>

<VirtualHost *:443>
  ServerName www.domain.com
. . .

Me likey!

Comments:

No comments!

Post a comment:

Username
Password
  If you do not have an account to log in to yet, register your own account. You will not enter any personal info and need not supply an email address.
Subject:
Comment:

You may use Markdown syntax in the comment, but no HTML. Hints:

If you are attempting to contact me, ask me a question, etc, please send me a message through the contact form rather than posting a comment here. Thank you. (If you post a comment anyway when it should be a message to me, I'll probably just delete your comment. I don't like clutter.)