[BlueOnyx:20716] Re: https redirect

Michael Stauber mstauber at blueonyx.it
Wed Feb 22 11:29:32 -05 2017


Hi Steffan,

> Im using
> <VirtualHost *:80>
>   ServerName webmail.website.com
>   RedirectPermanent / https://server.xxxx.com/roundcube/
> </VirtualHost>
> 
> To redirect every subdomain called webmail to roundcube https
> Now im trying to do the same for domains with https enabled
> But that does not work
> 
> Any idees how to set this up?

Yeah, that's tricky. If every Vsite has HTTPS enabled, you could simply
enable HSTS in the BlueOnyx GUI in "Server Management" / "Network
Services" / "Apache". That way every HTTP direction will immediately
redirected to HTTPS.

But like said: This will only work without grief if all Vsites have
HTTPS enabled and have an SSL certificate. Even then you might have to
tweak some Vsite settings to deal with situation where aliases or
subdomains are accessed, which also need to be included in the SSL
certificates of the VSites.

Another option is to throw a mod_rewrite rule into your above code
similar to the one you find in the 1st answer on this URL:

http://stackoverflow.com/questions/13977851/htaccess-redirect-to-https-www

This could for example also go into an .htaccess if you don't want to
put it into a siteX.include file.

Still: It all gets problematic if you do have Vsites that do not have
SSL enabled and do not have a cert present. Because you can't really
detect that without using Apache2::Config and some creative Perl
scripting that parses the Apache config on the fly. Manually putting a
.htaccess into the roundcube folder of all Vsites *with* SSL could fix
it for them, though.

It would certainly be easier if you give every site that doesn't have
SSL yet a Let's Encrypt cert and turn on automatic cert renewal for
them. That would allow you to either use HSTS or a global rewrite rule.

-- 
With best regards

Michael Stauber



More information about the Blueonyx mailing list