﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	uname	nginx_version
1264	proxy_set_header directives unable to be set in condition blocks	rigrassm@…		"Nginx will not allow the proxy_set_header directive to be used inside of a conditional statement block.

For example:
{{{
        server {
                //STUFF

		location / {
            	    proxy_buffering off;
            	    proxy_http_version 1.1;
            	    proxy_read_timeout 36000s;
		    proxy_set_header Host $host;
		    proxy_set_header X-Real-IP $remote_addr;
		    proxy_set_header Upgrade $http_upgrade;
		    proxy_set_header Connection ""upgrade"";
                    
                    if ($subdomain = ""plex"") {
                        proxy_set_header X-Forwarded-For   $proxy_add_x_forwarded_for;
            	        proxy_set_header X-Forwarded-Proto https;
            	        proxy_set_header X-Forwarded-Host $host;
            	        proxy_set_header X-Plex-Client-Identifier  $http_x_plex_client_identifier;
                    }
		    if ($subdomain) {
			proxy_pass $proxy_url;
    		    }
		}
	}
}}}

When the directives are set inside the conditional statement, Nginx will fail to reload giving the error below.

{{{
2017/05/04 10:45:56 [emerg] 64#64: ""proxy_set_header"" directive is not allowed here in /etc/nginx/nginx.conf:74

nginx: [emerg] ""proxy_set_header"" directive is not allowed here in /etc/nginx/nginx.conf:74
}}}

Since these conditional statements are in a valid location as specified in the documentation, they should be able to contain directives that would otherwise be allowed if the directives were set outside the conditional block. This is useful in my case as I proxy a number of applications and would like to be able to set headers based on the application I'm proxying to using the conditional statements."	defect	closed	minor		nginx-module	1.11.x	invalid	proxy_set_header		Linux xxxx.hostname.tld 4.10.9-100.fc24.x86_64 #1 SMP Mon Apr 10 14:47:56 UTC 2017 x86_64 GNU/Linux	"nginx version: nginx/1.11.13
"
