I use nginx 1.10.1 with config similar to this:
server {
(...)
add_header Header1 "value";
(...)
# in this location above add_header directive works
location / {
uwsgi_pass unix:/var/run/some.sock;
(...)
}
# ..and it this one it doesn't!
location ~* (^/$|favicon.ico|robots.txt) {
return 204;
expires 24h;
add_header Cache-Control "public";
etag on;
}
}
..so my problem is that Header1 is set for requests processed by the 1st location, but not for the 2nd one.
Why?
I have read add_header
docs and know that it works by default only for "positive" return codes, but 204 is one of them (I have actually tested changing the code to 200, 404 and it didn't help).
(I have also tried to add always
to my add_header Header1 ...
but it was a rather desperate try as it shouldn't help - and it didn't.)