Open mundschenk-at opened 8 years ago
Hey @mundschenk-at when did you discover this and how can we reproduce? Can you give me more data?
I've set up a fastcgi_cache
for our multisite network so that non-logged in users get a response directly from nginx instead of PHP. A few days ago, I noticed that the time-to-first-byte for my main blog was way too high for them to come from the cache. I added a caching indicator to the header, and indeed, every request was a cache miss
(not bypass
!). I also noted that Postmatic Social set a session cookie in that header (even for the start page, which does not contain a comment form!).
When I disabled Postmatic Social, the cache was hit normally again. I've not delved too deeply into the fastcgi_cache
module, but I think by default it adds the cookies to the cache key, resulting in a miss
all the time if the session cookie is not the same.
@filkaris do you want to start by looking into PMS setting cookies when it should not... and then, if it's a good fit, look into fastcg_cache compatibility?
Note from a user this weekend... could be a good lead:
It looks like Postmatic Social Login sets a cookie on every page load even if the plugin is not configured yet.
On some hosts using Varnish and the like, cookie activity like this will always cause a cache miss, rendering the server caching useless. Flywheel in particular has this reaction to plugins that behave this way.
Hey @cyberhobo do you have any thoughts on this?
I can verify the behavior and identify the code setting the cookie:
Unfortunately that session is made global which might make it a bit of a job to figure out everywhere it's used and how it can be refactored.
Ok let's push this to 1.2. Assigning to @filkaris for him to poke at.
Any news on this? I'd like to use the plugin, but with this bug in place, I can't.
Unfortunately, the plugin is currently incompatible with nginx'
fastcgi_cache
. When the plugin is enabled, the cache is never hit (most likely due to the session cookie set in every response header, even when a page does not contain a comment form).