Fastcgi_ignore_headers inside if{} - block

Hi.

I need set some fascgi_* inside “if” block. E.g.:

if ($foo = “bar”) {
fastcgi_ignore_headers “Set-Cookie”;
}

But the error is occure on configtest stage:

nginx: [emerg] “fastcgi_ignore_headers” directive is not allowed here

Is there any workaround?


Cheers,
Vitaliy

Hello!

On Sun, Mar 08, 2015 at 12:10:04PM +0200, wishmaster wrote:

nginx: [emerg] “fastcgi_ignore_headers” directive is not allowed here

Is there any workaround?

See these article for general hints:

http://wiki.nginx.org/IfIsEvil
http://wiki.nginx.org/IfIsEvil#What_to_do_instead

In this particular case, it should also be possible to use
fastcgi_ignore_headers unconditionally, with appropriate
fastcgi_no_cache additionally configured (see
http://nginx.org/r/fastcgi_no_cache for details).


Maxim D.
http://nginx.org/