How to fix: Nginx proxy or fastcgi cache always MISS or EXPIRED

I've recently had an issue with my Nginx setup: it wasn't caching or serving cached pages properly. Every time I would visit, I'd get "MISS" or "EXPIRED".

What I found online is that you have to instruct Nginx to ignore browser request headers relative to caching, therefore allowing Nginx to determine whether it should serve cache, all by itself.

This is done by inserting the following directive:

# ignore headers to let Nginx control its own cache
fastcgi_ignore_headers Cache-Control Expires;

However, I already had this in my configuration and it wasn't helping.

After investigating the issue, I determined that my PHP scripts were updating cookies at every request. Nginx was forced to execute the PHP scripts via FastCGI (ie. not serving them from cache) because the cookie data had changed. When PHP sets a cookie, Nginx will not hit the cache, which is normal behavior. I wouldn't recommend changing this behavior. What I did is fix my PHP scripts so that they wouldn't update cookies at every request. Once I did that, I started hitting the cache again!

One last thing: if you turn off fastcgi or proxy buffering, caching may not work properly, so make sure buffering is on (it should be on by default).


Ely setiawan said…
sangat bermanfaat kunjungi”>blog mas ely

[url=]mas ely[/url]


[ kata kunci]

[blog peternakan ely->]”>kata kunci

[peternakan ely|]

[mahasiswa peternakan ely](

“blog peternakan”:

mahasiswa peternakan (
Blogger said…
According to Stanford Medical, It's really the ONLY reason this country's women live 10 years more and weigh 42 lbs less than us.

(And by the way, it has totally NOTHING to do with genetics or some secret-exercise and EVERYTHING to do with "how" they eat.)

P.S, I said "HOW", and not "what"...

Click this link to reveal if this brief questionnaire can help you find out your true weight loss possibilities
Vevenia said…
Thanks for the help..
Maria said…
Watch and Download world's famous drama series Kurulus Osman in English on link below
Kurulus Osman in English

📢Get high quality backlinks for your
Website with BacklinksIndexer

Crypto trading online course
Join on link below
Crypto quantum leap

📒 Read Home doctor book online
Then you will be a doctor for your family
Home Doctor Book

💰Create own NFTs and earn 1000$
Complete guide
Create NFT

Join online YouTube course
And be a professional YouTuber
Tube Mastery and Monetization by matt

🦷Steel Bite Pro
Best product for
Teeth pain, cavities,teeth whitening and other oral health issues with money back guarantee
Steel Bite Pro
Anonymous said…
You know your projects stand out of the herd. There is something special about them. It seems to me all of them are really brilliant! how to drag click

Popular posts from this blog

Dealing with Nginx 400 Bad Request HTTP errors

How to fix: Outlook on iOS/iPhone: "No Internet Connection"

How to set up a simple mail server on Debian in 5 easy steps