changing the digital world one bit at a time...

Blants (noun) the rants of a blogger and XP – a bodge fix for chrome

December 4, 2015 by The Man

Ok as luck would have it the second site I set up‘s new certificates on the client was using Windows XP and Chrome and got this nasty error message when I redirected the http to https.

Now I’m a firm believer of https everywhere – yes I know it doesn’t solve every problem but it helps. So the options were bleak according to a github issue but if you are using Apache it’s possible to bodge a solution so XP Chrome clients can still see your site.

RewriteEngine on
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_USER_AGENT} !(Windows\ NT\ 5.1|Windows\ NT\ 5.2) [NC]
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI}

So what are we doing here.

First we check to see if https is off – not sure this is really needed as we are putting this in our :80 .conf file.

Then we check its NOT XP with the !

And finally we redirect to the https address.

Now we could get really clever and just check for Chrome on XP and I may work on that as I plan to use wherever I can 🙂