I have been messing around with Apache, trying to get it to rewrite https:// to http:// unless a secure authentication cookie is present, or the page requested was the login page.
Basically, my solution works for some browsers and not others. I think it may be because the cookie is names differently in some browsers, but I'm not sure.
Browsers that work:
Rekonq
FireFox (Linux)
AOSP browser
Browsers that go into an infinite redirect loop:
FF for Android
Here's the code I'm using to do the rewriting:
I.e. rewrite to http unless a cookie with the name "SSESS612cb529d2dfaadfff38b8731a3a4c8a" was sent, or the request headers contained the string "user" (which is in the login URL path).
Any cookie experts out there?
It's puzzling that FF for Linux works but FF for android doesn't.
P.S. That cookie name is the name of the secure authentication cookie for Drupal. The name is a unique string for my installation of Drupal (always the same) and although it looks like it should be secret it isn't, the secret bit is the string inside the cookie, which changes if you log in again.
Feathers
Basically, my solution works for some browsers and not others. I think it may be because the cookie is names differently in some browsers, but I'm not sure.
Browsers that work:
Rekonq
FireFox (Linux)
AOSP browser
Browsers that go into an infinite redirect loop:
FF for Android
Here's the code I'm using to do the rewriting:
Code:
# rewrite HTTPS to HTTP unless login page or HTTPS cookie is present # works in FF and Rekonq on Linux, AOSP browser but not FF for Android. RewriteCond %{HTTP_COOKIE} !^SSESS612cb529d2dfaadfff38b8731a3a4c8a RewriteCond %{THE_REQUEST} !user [NC] RewriteRule ^/(.*) http://www.samhobbs.co.uk/$1 [R=permanent,L]
Any cookie experts out there?
It's puzzling that FF for Linux works but FF for android doesn't.
P.S. That cookie name is the name of the secure authentication cookie for Drupal. The name is a unique string for my installation of Drupal (always the same) and although it looks like it should be secret it isn't, the secret bit is the string inside the cookie, which changes if you log in again.
Feathers
Comment