Proper way to require SSL on a virtual server?

6 posts / 0 new
Last post
#1 Mon, 01/18/2010 - 15:13
Denverb

Proper way to require SSL on a virtual server?

I am looking for the option to require SSL on a virtual server website. I see the option to require a client cert, but not one to require SSL on the server side. I assume I could change the apache port for that virtual server but that seems to be the wrong way to do it. I have not been able to find any info on this particular issue on this forum.

Mon, 01/18/2010 - 18:03
ronald
ronald's picture

on any existing server go to edit virtual server then enabled features and then choose SSL website enabled?
for new servers this can be set in the server template.
As long as it is enabled in the feature and plugins under system settings.

Tue, 01/19/2010 - 09:18
Denverb

Yes, I know how to enable SSL. I don't know how to make it required.

Tue, 01/19/2010 - 10:25
andreychek

This isn't easily done in Virtualmin itself at the moment... the simplest ways to do this would be to either have your application handle the redirect if it's not on the SSL port, or to use a .htaccess file, and put something like this in it:

RewriteEngine On
RewriteCond %{SERVER_PORT} !443
RewriteRule (.*) https://www.example.com/ [R]
Tue, 01/19/2010 - 17:51
ronald
ronald's picture

I did it like so RewriteEngine on
RewriteCond %{HTTP_HOST} =domain.com
RewriteRule ^(.*) https://www.domain.com [R]

and put it in the virtualhost container in the httpd.conf

Wed, 01/27/2010 - 11:54 (Reply to #5)
Denverb

For the time being I did this with a simple redirect and changes to the application.

Topic locked