allow traffic through with a certain header value nginx-forum at
Tue Jun 19 19:34:13 UTC 2018

Hi Nginx Forum
    This is my first posting here.

I'm trying to configure an application to only allow traffic if a certain
header value matches exactly.  I'm trying the "if" statement below in my
nginx app config file, but doesn't seem to quite work.     It just gives a
403 for every request.    If I change the != to = it allows allows all
traffic through.  "nginx -T" doesn't report any issues.      Any suggestions
on what else might be required?   Thanks a lot.

    location / {
	 if ($http_headerkey != "headervalue") {
         return 403; }
allow ....
allow ....

Posted at Nginx Forum:,280181,280181#msg-280181

More information about the nginx mailing list