Changing upstream response headers, before nginx caching decisions

Gryzli Bugbear gryzli.the.bugbear at gmail.com
Fri Jun 23 11:31:37 UTC 2017


Hello everybody,


I have the following working scheme:

Client --> Nginx [caching] --> Apache [backend]


Sometime the backend returns headers, which I want to modify before 
nginx caching engine decides how to treat them. One such example is when 
backend returns Vary:  header.


I want to achieve the following:


[Apache backend returns Vary: User-Agent, Header2] --> [Nginx Modifies 
"Vary:" and removes User-Agent] --> [Nginx caching sees only 'Vary: 
Header2' (without User-Agent)] --> The final result is that Nginx cache 
wont take 'User-Agent' into vary considerations. (no cache object per UA).

That's just an example. I would like to do such modification with other 
headers also (for example Cache-Control).

Currently I'm already using Nginx Lua integration, but there is no hook 
point before the caching engine.


Would be happy for any suggestions about achieving this scenario.


Regards



More information about the nginx mailing list