Http to https generates 301 instead of 200

In fresh installation of the latest version of virtualmin in ubuntu 20.04 the tests result in a loss of about 300ms because it seems that it first calls http and from there to https

curl -I --http2 -s https://domain.com/ | grep http

HTTP / 2 301

There is a way to make it direct to port 443 (https)
?
And so save those 300ms

Is there anything like this in your Apache config?

 <IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{HTTPS} off
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
 </IfModule>

I think forcing https this way (or something similar) is necessary for http/2 to work. And IfModule syntax will be slightly different for Ubuntu.

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