add_header is not working in certain locations

itpp2012 nginx-forum at nginx.us
Thu Aug 14 13:24:50 UTC 2014


Adding a few notes:
IF should only be used to return a state, ea. if ... 'error_page' and
nothing else because it breaks the chain of processing, when you really need
IF's, nested, setting values or otherwise use Lua.
For example: http://forum.nginx.org/read.php?2,251650,251777#msg-251777

The problem lays in event processing, while events are processed a single IF
won't do much harm (if ever) but additional IF's can cause strange things,

Event1 -> EP1 -> EP2 -> IF1 -> goto EP3 or EP4 -> IF2 (refers to the stage
between EP1 and EP2) so you are passed EP2 already when another IF is thrown
in, this may result in a loopback to EP2 which may end up at EP3 while your
IF1 wanted to go to EP4. Or IF2 processing produced a result which
overwrites the result of IF1.

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,252523,252573#msg-252573



More information about the nginx mailing list