amélioration des conditions pour redirection vers https

This commit is contained in:
Gregory Colpart 2021-05-03 13:21:22 +02:00
parent 32ae0b0d8e
commit 6ad080469a

View file

@ -315,7 +315,8 @@ La configuration d'un VirtualHost pour HTTPS pourra ainsi ressembler à :
#SSLCertificateChainFile /etc/ssl/certs/certificates_chain.pem
RewriteEngine On
RewriteCond %{HTTPS} !=on [OR]
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP:X-Forwarded-Proto} !=https
RewriteCond %{HTTP_HOST} !^secure.example.com$
RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [L,R=permanent]
</VirtualHost>
@ -825,6 +826,8 @@ RewriteCond %{REMOTE_ADDR} !^192\.0\.2\.129
RewriteRule ^/(.*) http://new.example.com/$1 [L,R=permanent]
# rediriger vers HTTPS sauf pour certaines requetes
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP:X-Forwarded-Proto} !=https
RewriteCond %{REQUEST_URI} !^/.well-known/pki-validation/
RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [L,R]
@ -883,7 +886,7 @@ dans Apache en utilisant la valeur de l'en-tête `X-Forwarded-Proto`
~~~
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} =http
RewriteCond %{HTTP:X-Forwarded-Proto} !=https
RewriteRule .* https://%{HTTP:Host}%{REQUEST_URI} [L,R=permanent]
~~~