simple auth question for nested sections

Jonathan Vanasco nginx at 2xlp.com
Wed Mar 23 23:56:29 UTC 2016


On Mar 23, 2016, at 2:14 PM, Francis Daly wrote:

> Any directives that inherit do not need to be repeated.
> 
> If it does not work for you, that's probably due to proxy_pass not
> inheriting.

Thanks - that's it -- `proxy_pass` does not inherit, but all the `proxy_set_header` directives in that block do.
Only the `proxy_pass` directive needed to be repeated in the location block (thank goodness!)

	location /foo {
			proxy_pass  http://127.0.0.1:6543;
			# nearly 10 lines of proxy_set_header 
			...
			location /foo/admin {
				proxy_pass  http://127.0.0.1:6543;
				auth_basic "Administrator Login";
				auth_basic_user_file /etc/nginx/_htpasswd/foo;
			}
	}

On Mar 23, 2016, at 7:20 AM, B.R. wrote:

> Why would you want to do that? Spaghetti configuration?


The proxy has a dozen lines of configuration.  
The `proxy_pass` line doesn't inherit, but the docs don't mention that.
Only the `proxy_pass` directive not inheriting was the last thing I expected.  So I had to run duplicate blocks until things worked.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20160323/0ec056b5/attachment.html>


More information about the nginx mailing list