[Apache] webmail and admin redirect not working

Hi,

when I create a new Virtual server following DNS records are created:

webmail.mydomain.tld.	IN	A	xxx.xxx.xxx.xxx
admin.mydomain.tld.	IN	A	xxx.xxx.xxx.xxx

And Apache directives for this virtual server includes following definitions:

ServerAlias webmail.mydomain.tld
ServerAlias admin.mydomain.tld
...
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.mydomain.tld
RewriteRule ^(.*) https://mydomain.tld:20000/ [R]
RewriteCond %{HTTP_HOST} =admin.mydomain.tld
RewriteRule ^(.*) https://mydomain.tld:10000/ [R]

But when I try to access to webmail.mydomain.tld or admin.mydomain.tld I get an SSL issue (SSL_ERROR_BAD_CERT_DOMAIN).

If I have a look at my SSL certificate I see thoses subdomains are not included into the certificate request. This seems normal due to the fact that apache should redirect them to respective parent domain on specific ports (10000 or 20000).

Any idea why apache redirection are not working ? I still blocked on webmail.mydomain.tld and admin.mydomain.tld

Regards,

If you hit the URL with http instead of https, it should Just Work (Webmin and Usermin should use the same cert as the domain automatically), and will redirect to https on their respective ports. I guess we just didn’t take into account someone entering https there (and, I guess some browsers try https first when no protocol is specified). I’m not sure we want to add it automatically to the certificate, as validating it will be more likely to fail (because the user didn’t setup DNS for those names, or any variety of other things). I think you could add them, though. I think Virtualmin is smart enough to skip redirects and proxy rules for the .well-known dir, but if not, let us know.

Edit: Redirects are working, very clearly so. It’s just trying to validate a cert against the wrong domain. Skipping that (by using http) will avoid that validation failure.

Hi,

thanks for your feedback. After doing more tests its seems it’s an issue related to my browser. I find this because on certain browsers on my computer redirects are just working fine and some others not. The one that are not working (on my firefox for example) are working on another browser (opera). So it’s seems not to be a bug related to Virtualmin.