Hi again,

And ugh, yet again realising what I did wrong right after hitting "send":

Daniël Mostertman schreef op 18-2-2015 om 17:57:
tl;dr: I want do have an add_header inside an if {}. nginx 1.7.10 won't let me.
Because I didn't put the if inside a location.

According to both http://wiki.nginx.org/IfIsEvil and http://nginx.org/en/docs/http/ngx_http_headers_module.html (see Context of add_header), it should be allowed inside an if.
But yet:

root:~# nginx -t
nginx: [emerg] "add_header" directive is not allowed here in /etc/nginx/sites-enabled/webtv-test:37
nginx: configuration file /etc/nginx/nginx.conf test failed
root:~#

What am I doing wrong, if anything? And if I can avoid using "if" like that, I'd obviously prefer that.

Answering my own question: "add_header" can only be inside an "if" that's inside a "location".
I have no "location" for the root, so I figured it could be inside "server".

Daniël

_______________________________________________
nginx mailing list
[email protected]
http://mailman.nginx.org/mailman/listinfo/nginx

Reply via email to