Breaking Cache on Every Page
-
Varnish has been working well at http://sarahwallinhuff.com/ but after EDD, it has been returning Age: 0 for every single page on the site, the home page, single posts/pages, all of them.
This appears to be because EDD establishes the session cookie no matter where you enter the site, despite not using the Cart widget, and only utilizing EDD on http://sarahwallinhuff.com/index-of-available-works-by-instrumentation/ and the cart/checkout pages.
It would be awesome, if EDD simply invalidated the cache for the pages it operated on, not the whole site.
We love EDD, but we love our cache too. Any help would be greatly appreciated, thank you!
-
Hey James,
Who is your site hosted with?
DreamHost on the DreamPress platform.
Can you go to Downloads > Tools > System Info and paste the contents here for me?
Thanks, Pippin, it’s:
### Begin System Info ###
— Site Info
Site URL: https://sarahwallinhuff.com
Home URL: http://sarahwallinhuff.com
Multisite: No— Hosting Provider
Host: DBH: mysql-1.sarahwallinhuff.com, SRV: sarahwallinhuff.com
— User Browser
Platform: Apple
Browser Name: Safari
Browser Version: 8.0.2
User Agent String: Mozilla/5.0 (Macintosh; Intel Ma
c OS X 10_10_1) AppleWebKit/600.
2.5 (KHTML, like Gecko) Version/
8.0.2 Safari/600.2.5— WordPress Configuration
Version: 4.1
Language: en_US
Permalink Structure: /%year%/%monthnum%/%day%/%postname%/
Active Theme: Twenty Fourteen Custom 1.0
Show On Front: posts
Remote Post: wp_remote_post() works
Table Prefix: Length: 10 Status: Acceptable
Admin AJAX: Accessible
WP_DEBUG: Disabled
Memory Limit: 40M
Registered Post Stati: publish, future, draft, pending, private, trash, auto-draft, inherit, refunded, failed, revoked, abandoned, active, inactive, spam— EDD Configuration
Version: 2.2.2
Upgraded From: 2.1.4
Test Mode: Disabled
Ajax: Enabled
Guest Checkout: Enabled
Symlinks: Disabled
Download Method: Direct
Currency Code: USD
Currency Position: before
Decimal Separator: .
Thousands Separator: ,— EDD Page Configuration
Checkout: Valid
Checkout Page: http://sarahwallinhuff.com/checkout/
Success Page: http://sarahwallinhuff.com/checkout/purchase-confirmation/
Failure Page: http://sarahwallinhuff.com/checkout/transaction-failed/
Downloads Slug: /downloads— EDD Gateway Configuration
Enabled Gateways: PayPal Standard
Default Gateway: PayPal Standard— EDD Tax Configuration
Taxes: Disabled
Tax Rate: 0
Display On Checkout: Not Displayed
Prices Include Tax: No— Must-Use Plugins
— WordPress Active Plugins
Akismet: 3.0.4
Clef: 2.2.9.1
Easy Digital Downloads: 2.2.2
EDD – Prevent Checkout for the EU: 1.0.7
Jetpack by WordPress.com: 3.3
PuSHPress: 0.1.7.2
The Events Calendar: 3.9
Varnish HTTP Purge: 3.5.1
VaultPress: 1.7.0
WordPress SEO: 1.7.1— WordPress Inactive Plugins
— Webserver Configuration
PHP Version: 5.6.0
MySQL Version: 5.1.39
Webserver Info: Apache— PHP Configuration
Safe Mode: Disabled
Memory Limit: 256M
Upload Max Size: 100M
Post Max Size: 100M
Upload Max Filesize: 100M
Time Limit: 500
Max Input Vars: 1000
Display Errors: On (1)— PHP Extensions
cURL: Supported
fsockopen: Supported
SOAP Client: Installed
Suhosin: Not Installed— Session Configuration
EDD Use Sessions: Disabled
Session: Disabled### End System Info ###
(Note, despite what is quoted above, Settings -> General has both site and home as HTTP, not HTTPS.)
Looks like you have disabled PHP sessions. Could you add this to your wp-config.php and see if that resolves it?
define( 'EDD_USE_PHP_SESSIONS', true );Added the line, updated to 2.2.3, and flushed Varnish.
Instead of getting a cookie titled
edd_wp_sessionon every page, now I’m getting a cookied titledPHPSESSIDon every page, but Varnish is still returning Age: 0, so maybe it’s not EDD.Ok, I tried a few more configurations, it’s definitely still EDD.
Previously, on the hosting provider’s recommendation, I had
define( 'EDD_USE_PHP_SESSIONS', false );in wp-config.php and that was causing theedd_wp_sessioncookie to fire on every page.After placing
define( 'EDD_USE_PHP_SESSIONS', true );instead on your suggestion, thePHPSESSIDcookie fired on every page instead.If I deactivate EDD, no session cookies are fired.
Unfortunately, both style of session cookies will kill the Varnish cache.
I don’t mind EDD killing the cache, I know why it has to, I just wish it only fired those cookies on pages with EDD elements (the store page, the cart, checkout, wherever the cart widget is, etc).
I’m going to ping Mika Ipstenu (she works at Dreamhost and uses EDD) to see if she happens to know anything here.
PHP Sessions will ALWAYS prevent Varnish from caching. That’s kinda obvious when you think about it, since a PHP session is telling the browser “Hi, I need a special PHP session here, unique to the user.” Setting that to false will work better on most (if not all) caches.
There are two things here.
1) https == no Varnish cache. Varnish cannot, will not, cache https. The devs chose not to. Can’t fix that. (Which is why I recommend using HTTPS only where one needs https, and thank GOD EDD lets you do that easily).
2) The ‘age’ is set to 0 (James, we talked about that I thought…) Check out http://www.isvarnishworking.com/ – It’s dead simple tool to check and you can see this:
Set-Cookie: edd_items_in_cart=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/
So here we have a cookie (which I’ve already told James’ Varnish to ignore) and THEN we have an expires of 1970 and a Max-Age of 0… which both tell Varnish “This page expired, please recache.”
No kidding it ain’t caching right :/
I would put dollar down on some rogue JS doing it. I saw this with a plugin from Yikes! that did this too, but last week I didn’t have sit-down time to debug since I was doing training classes :/
Edited to add: https://cloudup.com/iJOs4C40SGK
That’s not on DreamPress, as it happens. And yes, it goes away if I disable EDD π
Thanks for double-checking, Mika! Much appreciated. π
Does it only happen, per chance, after an item is added to the cart?
No, it’s always there, even if you just enter at the domain via an Incognito window.
Could you set EDD_USE_PHP_SESSION to false for me? I’d like to look at your site with that setting. I have an idea.
Done, thanks again!
I just noticed that I’m also getting a
edd_wp_sessioncookie in wp-admin too, even if I go to it directly and log in via an Incognito window without visiting the front-facing portion of the site.I get the feeling that probably shouldn’t happen, since I can’t buy anything from the Dashboard.
The topic ‘Breaking Cache on Every Page’ is closed to new replies.