Response Header IF statement problem

Francis Daly francis at
Fri Feb 16 15:37:56 UTC 2018

On Fri, Feb 16, 2018 at 01:49:59PM +0000, Friscia, Michael wrote:

Hi there,

> Thank you, this was incredibly useful and helped me think this through in Nginx terms and I have everything working now. Thank you again!

You're welcome.

Good to hear that you have things working the way you want them to.

> Minor side question, is there a variable I can use to post to a debug header to indicate if a page was newly written to the cache versus a page that was read from cache? If I had this information, then from a tier2/3 support side it could speed up debugging.

Possibly $upstream_cache_status?$upstream_cache_status, or a section in for more information.

If the seven states of that variable reveals more information than
you want to, you could use a map to turn three values into "it came from
upstream", and four into "it came from cache", and just send that binary
value in the debug header.

Note that that variable is not exactly what you asked for; it might be
close enough for what you want.

Francis Daly        francis at

More information about the nginx mailing list