Outils personnels
Vous êtes ici : Accueil Blog Zope en SSL uniquement sur le login_form et le manage
Navigation
 
Actions sur le document

Zope en SSL uniquement sur le login_form et le manage

Filed Under:

Zope en SSL uniquement sur le login_form et le manage. Le reste du site on navigue en http

Pour la partie Non SSL
# Secure login and management screens
# The first line handle the case of a redirect to login_form from a protected page
# and it rewrites it to point to the secure login form with the came_from= URL rewritten from http to https.
# The last line handles the default case without a "came_from=" in the URL.
# For info NE 'noescape|NE' (no URI escaping of output)
# This flag keeps mod_rewrite from applying the usual URI escaping rules to the result of a rewrite.
# Ordinarily, special characters (such as '%', '$', ';', and so on) will be escaped into their
# hexcode equivalents ('%25', '%24', and '%3B', respectively); this flag prevents this from being done.
# This allows percent symbols to appear in the output, as in
#
#    RewriteRule /foo/(.*) /bar?arg=P1\%3d$1 [R,NE]
#    which would turn '/foo/zed' into a safe request for '/bar?arg=P1=zed'.
#
RewriteRule ^/login_form(.*) https://monsite.fr/login_form$1 [NE,L] [OR]
RewriteRule ^/manage(.*) https://monsite.fr/manage$1 [NE,L] [OR]
# Insecure screen for all
RewriteRule ^/(.*) http://localhost:8080/VirtualHostBase/http/monsite.fr:80/Kwa29/VirtualHostRoot/$1 [P,L]
Pour la Partie SSL
<VirtualHost *:443>
RewriteEngine On
RewriteCond %{QUERY_STRING} ^came_from=https(.*)$
RewriteRule ^/(.*) $1?came_from=http://%{SERVER_NAME}/&retry=&disable_session_login__=1 [R,L]
RewriteRule ^/(.*) http://localhost:8080/VirtualHostBase/https/monsite.fr:443/Kwa29/VirtualHostRoot/$1 [P,L]
</VirtualHost>
BONUS sur les Rewrite

# Force clients from the Internet to use HTTPS
RewriteEngine on
RewriteCond %{REMOTE_ADDR} !^192\.168\.1\.[0-9]+$
RewriteCond %{HTTPS} !=on
RewriteRule .* - [F]


RewriteCond %{query_string} ^id=(.*)$
RewriteRule page\.php /dossier/%1/? [R=301,L]

RewriteEngine on
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^mon_repertoire(.*$) https://%{SERVER_NAME}/mon_repertoire$1 [R,L]

RewriteLog /var/log/apache2/https_rewrite.log
RewriteLogLevel 1
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [L,R]