I'm running into some trouble with my Apache 2.4 config. Accessing https://subdomain.my-domain.com always returns this http 400.
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.
I'm accessing my site via https directly so there is no redirect from http to https involved. Below my apache config. I'm aware that I don't check the certificates for validity. Right now they're just self signed but that will change in the future.
##################################################################
### ###
### Global Settings ###
### ###
##################################################################
DocumentRoot /var/ebc/apache2/www/htdocs
<Location /fwcheck.html>
<RequireAll>
Require all granted
</RequireAll>
</Location>
##################################################################
### ###
### Global SSL Settings ###
### ###
##################################################################
SSLProtocol ALL -SSLv2 -SSLv3
SSLProxyProtocol ALL -SSLv2 -SSLv3
SSLHonorCipherOrder on
SSLCipherSuite ECDHE-RSA-AES128-SHA256:AES128-GCM-SHA256:HIGH:!MD5:!aNULL:!EDH
SSLCompression off
SSLSessionTickets off
# OCSP Stapling, only in httpd 2.3.3 and later
SSLUseStapling on
SSLStaplingResponderTimeout 5
SSLStaplingReturnResponderErrors off
SSLStaplingCache shmcb:/var/ebc/apache2/sslstaplingcache(128000)
##################################################################
### ###
### Virtual Hosts ###
### ###
##################################################################
<VirtualHost 10.173.144.43:80>
ErrorLog /var/ebc/apache2/log/error.log
CustomLog /var/ebc/apache2/log/access.log vhost_combined
##################################################################
### ###
### Send everything to https except firewall check ###
### vhost config only for port 443 necessary. ###
### No further config for port 80. ###
### ###
##################################################################
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !fwcheck.html
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
##################################################################
</VirtualHost>
<VirtualHost 10.173.144.43:443>
ServerName subdomain.my-domain.com
ErrorLog /var/ebc/apache2/log/error.log
CustomLog /var/ebc/apache2/log/access.log vhost_combined
##################################################################
### ###
### SSL Settings ###
### ###
##################################################################
RequestHeader set ClientProtocol HTTPS
SSLEngine On
SSLProxyEngine On
SSLCertificateFile /var/ebc/apache2/ssl/subdomain.my-domain.com.crt
SSLCertificateKeyFile /var/ebc/apache2/ssl/subdomain.my-domain.com.key
SSLCACertificateFile /var/ebc/apache2/ssl/subdomain.my-domain.com.crt
ProxyRequests off
ProxyPreserveHost on
# Disable certificate checks
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
# HSTS (15768000 seconds = 6 months)
Header always set Strict-Transport-Security "max-age=15768000"
##################################################################
### ###
### Locations ###
### ###
##################################################################
DocumentRoot /var/ebc/apache2/www/htdocs/prod
<Location />
Options None
<RequireAll>
Require all granted
</RequireAll>
</Location>
<Location /web-status>
<RequireAll>
Require all denied
</RequireAll>
</Location>
<Location /balancer-manager>
<RequireAll>
Require all denied
</RequireAll>
</Location>
##################################################################
</VirtualHost>
I don't really have an idea why this does not work. Can anyone give me a hint?
Thanks in advance guys and regards Sebastian
Your connection does not arrive on interface 10.173.144.43:443 so it's not handled by your VirtualHost
. It hits the main server configuration which does not have SSL enabled.
If you don't care what local interface is used, use a * in VirtualHost
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.