skip to content
  • How to configure W3 Total Cache to work with HTTPS and SSL

    by on November 11, 2011 1 Comment

    We’ve worked with a few sites recently that use HTTPS to secure certain parts of there site. Some of the pages are SSL protected due to the data captured (pages processing registration or financial information, for example).

    When using a CDN in conjunction with HTTPS / SSL, customers often find that the CDN product they use lacks an HTTPS endpoint, or the one provided is different from the standard, non-HTTPS one.

    One simple solution to this would be to force the loading of your CDN assets via HTTP like so:

    This leads to one other issue, however…

    Why dont I see the Blue/Green Bar?


    When a page and all of its assets are served over HTTPS, modern web browsers provide a visual indicator—usually in green or blue. This is designed to provide visitors with the confidence to shop or register on your site.

    When your HTTPS pages are served with “mixed content” (as it sounds, this is a situation in which HTTPS and HTTP assets are both being loaded on a single page, this indicator does not appear. This could happen for any number of reasons — all beyond the scope of this article — but there’s a simple solution for addressing this with only a few short lines of code.

    Disabling CDN on HTTPS pages only

    W3 Total Cache ships with documentation (Performance > FAQ) that provides instructions on disabling each of the caching types. Combined with a simple PHP function and WordPress hook, we’re able to conditionally disable the CDN for pages that utilize HTTPS.

    Add the following code snippet to your theme’s functions.php file:

    add_action('wp_head','nocdn_on_ssl_page');
    function nocdn_on_ssl_page() {
    if ($_SERVER['HTTPS'] == "on") {
    define('DONOTCDN', true);
    }
    }

    This of course assumes that you have W3 Total Cache active and that the only assets being served over HTTP are originating from your CDN (otherwise, you might need something like this). When you reload a page being served over HTTPS, you should notice that the familiar green / blue indicator appears in your address bar.

    Note: we’ve found that MaxCDN‘s SSL support and easy integration with W3 Total Cache provides a solid solution for many customers.

This entry was posted on Friday, November 11th, 2011 at 4:42 pm and is filed under CSS / Markup / Code. You can follow any responses to this entry through the RSS 2.0 feed.


Comments are closed.
February 7, 2011 97

Optimize the Performance of Widgets, Buttons & More

Too much 3rd Party content can slow down the growth of your site, reduce engagement, conversions and more. Learn how you can still incorporate widgets, plugins etc and still have a site that does not force your visitors to leave and never return.

View
March 9, 2009 81

Do's and Don'ts to Improve Google Ranking

Google Ranking Factors, The Good and the Bad. There are lots of opinions on how Google actually ranks your web site in the search result pages — take a closer look at what matters and why.

View
February 25, 2008 90

Get Your Blog Google Ranked in 30 Days or Less

Blogs are great for updating content quickly, creating a site community, and they even make search engines happy. Unfortunately, many site owners mis-use or under-utilize their blogs so here are 50 tips to boost your blogs performance.

View

Testimonials

Wow! They have done an amazing job with our project. I can't thank them enough, I have been searching for a company to do just this and I am very thankful to have found W3 MARKUP. I will definitely be working with them in future with more of our projects.

Raymond Benc, phpFox