1

I have

gzip_vary on;

I also have (inside a server section):

add_header Vary Origin;

Yet when I inspect headers sent, the Vary header only includes Accept-Encoding; if I remove the gzip_vary on; line then there is no Vary header emitted at all.

I'm on nginx 1.10.3, can anyone shed light?

artfulrobot
  • 2,627
  • 11
  • 30
  • 56
  • Do you have any other `add_header` in locations which are defined later on? Make sure to account for the fact of how this directive is inherited: if you have a directive on the inner location, then any directive from outer is "lost". – Danila Vershinin Dec 03 '19 at 23:29
  • I do not have any other `add_header` (at least not for "Vary"), although even if I did I would expect those to be added to the output, possibly by concatenation on a single header, as is documented - I think it's a standard that multiple headers of the same type are valid and may be treated the same as a concatenated one. – artfulrobot Dec 05 '19 at 09:12
  • Note: While I'm still interested in this behaviour, my reason for needing this was that my CORS responses were being cached and therefore a cached response to one origin was being sent to another for which it is invalid. I solved that by ensuring the `$http_origin` variable was included in the cache key value. – artfulrobot Dec 05 '19 at 09:13

0 Answers0