Salut la planète,
J’aimerais résoudre un problème sur mon serveur Apache 2.4. Je voudrais faire une redirection http vers https de mon domaine mais j’obtiens une réponse type 400 quand j’essaie en http :
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.
Je n’ai pas trouvé comment y parvenir.
Pouvez-vous m’aidez ?
Voici ma conf apache :
<VirtualHost *:80>
ServerName mondomaine.fr
ServerAdmin XXX@gmail.com
DocumentRoot /var/www/html/owncloud
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
#Include conf-available/serve-cgi-bin.conf
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
#RewriteCond %{SERVER_NAME} = mondomaine.fr
#RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
</VirtualHost>
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName mondomaine.fr
ServerAdmin XXX@gmail.com
DocumentRoot /var/www/html/owncloud
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
#Include conf-available/serve-cgi-bin.conf
RewriteEngine on
# Some rewrite rules in this file were disabled on your HTTPS site,
# because they have the potential to create redirection loops.
# RewriteCond %{SERVER_NAME} = mondomaine.fr
# RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
SSLCertificateFile /etc/letsencrypt/live/mondomaine.fr/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/mondomaine.fr/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>
Merci !