#google chrome #http #https #ssl #woocommerce
I was setting up a demo for a WordPress theme which utilizes WooCommerce. All good, until on 25 June everything broke. Inspecting the browser console it appeared to try to load all assets (css, js, images) over HTTPS, though my servers (both locally and online) had no SSL setup. Also the login page was redirected to https by force so I couldn’t even get into my WordPress admin area. It became even weirder when discovering that it was only broken in Chrome (I’m using the Chrome beta), not in Firefox. You’d think the WordPress pages render server-side so the browser has no influence on rewriting URLs to SSL variants. The issue being so recent meant I couldn’t find anything about it online, combined with not really knowing what to look for (is it WooCommerce specific? Chrome specific? Chrome version specific?).
After digging a bit through the WooCommerce code I found it does a lot of is_ssl() checks. Echoing is_ssl() in my theme before any other execution indeed showed “true”. So next I looked up the is_ssl() function in the WP core to see how it comes to this conclusion and if there’s a filter to hook in to. No filter but one thing it looks for is $_SERVER[‘HTTPS’]. When echoing $_SERVER (
var_export( $_SERVER ); die();), it indeed shows HTTPS as true… That brought me to the following hack which fixes the issue:
$_SERVER['HTTPS'] = false;
is_ssl() will then return false as it should.
Note that this might not apply to your situation and only do this if you really don’t have an SSL certificate installed and remember to fix it when you do later.
Finally found this topic in WordPress.org support forum addressing the exact issue: https://wordpress.org/support/topic/site-broken-in-chrome-ssl-issue and it mentions this concerns Chrome version 44+.
Now a Chromium issue: https://code.google.com/p/chromium/issues/detail?id=505268
Update to the latest WooCommerce version (2.3.12+) to fix it.
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>