Virtualmin 7 Beta - HTTPS Redirect Not Working

| OS type and version | Ubuntu 22.04
| Webmin version | 1.994
| Virtualmin version | 7.1-1

HTTPS redirect was working in the previous version, but I did a fresh install of Ubuntu 22.04 and Virtualmin 7 and I find that HTTPS redirect is not working.

The setting is located here:
Webmin>Webmin Configuration>SSL Encryption>SSL Settings
Redirect non-SSL requests to SSL mode?>toggle to yes

According to the logs, this sets the ssl_redirect variable in miniserv.conf to 1.

Alternatively, I can add a directive in Apache settings to accomplish a redirect:
“Redirect permanent / https://example.net/

It’s not perfect, because this is not a global directive, and it is per-site only.

Thanks

For sites served by Apache, I usually use

RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

in .htaccess. There are other ways, of course.

The original advantage was that during the transition from when most pages of most sites weren’t encrypted, to the present situation where everything is expected to be encrypted, it was one snippet of code I could quickly paste into any site to accomplish that. Nowadays it’s just habit.

Richard

How does Virtualmin 6 do it? Which mechanism does it employ?

This is not something that has changed between Virtualmin 6 and 7, to the best of my knowledge.

Can you please be a little more verbose?

Specifically, what does setting the ‘ssl_redirect’ variable in miniserv.conf to ‘1’ do?

You say it has not changed, but there’s definitely been a regression in that the functionality ceased.

This should be filed as a bug report, but I am not a premium user.

I don’t actually know what you’re talking about here. It sounds like you’re trying to have a site in Apache (presumably a Virtualmin managed site) redirected to SSL when the user connects on HTTP instead.

But, all of the settings you’re talking about are Webmin settings, and have nothing to do with Apache or Virtualmin.

This configures the Webmin web server (which is not Apache and is not what serves your Virtualmin sites).

This would be completely unrelated to the Webmin settings you’re talking about, and would effect Apache sites. Virtualmin has an option for this on a per-domain basis, but it’s not the one you’re asking about above.

Configures the Webmin web server (not Apache, and not your Virtualmin-managed sites) to redirect non-HTTPS requests to HTTPS.

So, what are you trying to accomplish here? Are we talking about Webmin and its web server, or are we talking about the sites that Virtualmin manages in Apache?

But, also, the Webmin settings definitely have not changed in Virtualmin 7 because they are not in the Virtualmin modules, they’re in core Webmin, and this is not an option we alter during installation (everything Virtualmin configures in Webmin can be seen in the Webmin.pm module in virtualmin-config package here: Virtualmin-Config/Webmin.pm at master · virtualmin/Virtualmin-Config · GitHub )

As you can see, we enable SSL, but do not enable ssl_redirect, and nothing much has changed in this module in virtualmin-config since it was written years ago.

Indeed… I see that this is in fact true and that you are in fact correct:

From here:

“Webmin comes with a very simple webserver called miniserv.pl that is capable of doing all that is necessary for Webmin to run.”

Sorry, my misunderstanding… I was in fact aware of this setting:

Virtualmin Configuration>SSL Settings>Redirect HTTP to HTTPS by default

But I thought that all it did was set the former setting in Webmin to on automatically when creating a new virtual server.

Now I understand it to mean that this does the redirects for the actual site which is hosted by Apache (or nginx).

Can you please share with us what the setting actually does? Is it applying a domain directive?

Thanks

No. That option is for Virtualmin managed virtual hosts (in Apache or nginx). Has nothing to do with Webmin. And, Webmin does not have a per-domain option for this; it is on or off for Webmin.

What setting? I’m still not clear what you’re trying to do! Are you trying to redirect your domains (in Apache) to HTTPS if connections come in on HTTP? Or are you trying to do that in Webmin?

To clarify please: I am trying to do redirect my domains in Apache. It is working for me now. However, I am requesting that you please tell me what is the mechanism which virtualmin employs to effect this?

Thanks

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.