fastcgi_ignore_headers inside if{} - block

Maxim Dounin mdounin at mdounin.ru
Tue Mar 10 14:22:08 UTC 2015


Hello!

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

> 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?

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 Dounin
http://nginx.org/



More information about the nginx mailing list