This problem has cost me a few hours trying to fix and I simply have no clue - so huge thanks in advance to anyone that can help me solve this.
This is the Bad Request 400 error I get:
Bad Request
Your browser sent a request that this server could not understand.
Reason: You're speaking plain HTTP to an SSL-enabled server port.
Instead use the HTTPS scheme to access this URL, please.
And this is my vhosts file:
<Directory /var/www/sub1>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<VirtualHost *:80>
ServerName sub1.site1.com
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</VirtualHost>
<VirtualHost *:443>
ServerName sub1.site1.com
DocumentRoot /var/www/sub1
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/sub1.site1.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/sub1.site1.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/sub1.site1.com/chain.pem
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Here's the strange part - as long as I specify port 80 at the end of the URL - it works fine.
If I DON'T type in http:// at the front of the URL - it works fine.
-BUT-
If I type in http://sub1.site1.com - it throws the above error.
I'm not sure if my apache2 config or the fact that I used certbot on my ubuntu server has something to do with this odd error, but I've tried everything I can think of to fix it.
So why would:
sub1.site1.com
sub1.site1.com:443
https://sub1.site1.com
http://sub1.site1.com:80
All work just fine, but
http://sub1.site1.com
Throw the above error rather than just automatically redirecting to one of the 4 url's that work fine?