multiple add_header directives in different contexts

Andrew Benton andrewmbenton at gmail.com
Mon Oct 17 05:51:48 UTC 2011


so i have a configuration like this:

...
http {
    ...
    add_header X-Bleep bloop;
    server {
        ...
        add_header X-Foo bar;
    }
    server {
        ...
    }
}

and only "X-Bleep: bloop" is showing up in responses. is this expected
behavior? is there any way to have multiple add_header directives in
separate contexts work as i would expect? that is, every response
includes "X-Bleep: bloop" but only requests matching the first server
block should have "X-Foo: bar" as well?

i know i could add the first add_header directive to every server
block, but i have a lot of server blocks and this header may have to
change so it would be a maintenance nightmare.

thanks for your help!

amb



More information about the nginx mailing list