I'm trying to have a common rewrite rule so that all http traffic gets rerouted to https.
The following is sitting loose in the configuration
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
But I'm still getting bad request, I'm speaking plain HTTP to an SSL-enabled server port. I also tried with condition
RewriteCond %{SERVER_PORT} !^443$
Is it because rewrite rules must be contained with a virtual host?