Re: add_header is not working in certain locations

2014-08-14 Thread Francis Daly
On Thu, Aug 14, 2014 at 10:16:43AM -0400, bodomic wrote: Hi there, > Actually, the second problem is described in this document too, I think I > should re-read it every time I want to use IF. "if" is fine. It is only "if inside location" which needs care. My general guideline is: do "return .

Re: add_header is not working in certain locations

2014-08-14 Thread bodomic
Actually, the second problem is described in this document too, I think I should re-read it every time I want to use IF. In my example (before posting it here) I've dropped the second IF in the same location without much thought. That's why it worked for you. That's why it worked in a separate loca

Re: add_header is not working in certain locations

2014-08-14 Thread bodomic
Thanks for your reply, I've actually found the second traitor (i.e. why second example won't work), will reply to Francis's post once more. Posted at Nginx Forum: http://forum.nginx.org/read.php?2,252523,252574#msg-252574 ___ nginx mailing list nginx@n

Re: add_header is not working in certain locations

2014-08-14 Thread itpp2012
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 prob

Re: add_header is not working in certain locations

2014-08-14 Thread bodomic
Hi Francis, Thanks for your thoughtful entry. It seems that it is a cloudy area of buggy 'if' behaviors :) I've created empty host config with just 'location /' and 'if ... add_header' and proxy_pass - and it works fine. I'll have to retest this situation on my real server though to find out if m

Re: add_header is not working in certain locations

2014-08-13 Thread Francis Daly
On Wed, Aug 13, 2014 at 02:28:27AM -0400, bodomic wrote: Hi there, > Hi all, I've got strange behavior that I don't understand in two different > configs. I'll post examples below, in both of them I use add_header two > times and one of them is not working while second does. > > Example 1: > Req

add_header is not working in certain locations

2014-08-12 Thread bodomic
Hi all, I've got strange behavior that I don't understand in two different configs. I'll post examples below, in both of them I use add_header two times and one of them is not working while second does. Example 1: Request is: http://hostname/?region=XX #This location adds header, so it's frankly