PHOENIX-MEDIA / Magento-PageCache-powered-by-Varnish

Community version which is available on Magento Connect (http://www.magentocommerce.com/magento-connect/pagecache-powered-by-varnish.html)
89 stars 49 forks source link

No cache anymore since I switched to HTTPS #60

Closed alterego23 closed 7 years ago

alterego23 commented 7 years ago

Hi,

I successfully switched to HTTPS by :

Now, Varnish is not caching anymore. Is it caused by phonix-media module which can't handle https?

I delete this "req.http.Https" in default vcl but still does not work:

not cacheable by default

if (req.http.Authorization || **req.http.Https**) {
    return (pass);
}

Someone has a store running on HTTPS with varnish caching static files and html pages ?

Thank you.

bjoern-tantau commented 7 years ago

What are you using to terminate HTTPS? Varnish can't do that alone. You need Nginx or HAProxy in front of it. No problems with HTTPS here, apart from my pull request in #59.

alterego23 commented 7 years ago

I'm using Apache proxy to offload HTTPS

So my setup is like this:

Apache proxy (443) -> Varnish (80) -> Apache (8080).

I posted my apache conf and vcl on stackexchange: http://magento.stackexchange.com/questions/162007/apache-proxy-varnish-magento-https-not-caching

Do you see any misconfiguration?

The only things I added in .vcl are

Thank you.

pocallaghan commented 7 years ago

Your issue is likely that Phoenix_VarnishCache_Helper_Cache ::setCacheControlHeaders has this check:

    // disable caching of secure pages
    if (Mage::app()->getStore()->isCurrentlySecure()) {
        return $this->setNoCacheHeader();
    }

Which means by default the extension won't cache https pages. You can rewrite the helper and comment that check out if you have the server configured correctly (which at a glance you do). Obviously perform tests in a test environment, yadayada.

alterego23 commented 7 years ago

Hi pocallaghan,

I'll test this today, I'm pretty sure that this will fix my problem. I'll let you know!

Have a nice day!

alterego23 commented 7 years ago

Hi pocallaghan,

I commented the lines in the helper. Varnish is now caching HTTPS pages 👍

Problem solved.

Thank you !

pocallaghan commented 7 years ago

Now just be careful you aren't caching anything important (like the form_key on the product page).

alterego23 commented 7 years ago

OKay but I'm using Magento CE 1.5.1. I think that this version doesn't use "form_key" on product page. Is it correct ?