proxy_redirect can't be def'd in an include file; ok in main config?

Maxim Dounin mdounin at mdounin.ru
Wed Jan 22 01:04:38 UTC 2014


Hello!

On Tue, Jan 21, 2014 at 11:30:29AM -0800, rand at sent.com wrote:

> 
> 
> On Tue, Jan 21, 2014, at 11:10 AM, Maxim Dounin wrote:
> ...
> > And it's certainly a wrong list to write such questions.  Thank 
> > you for cooperation.
> ...
> 
> > Hello!
> > 
> > On Tue, Jan 21, 2014 at 10:55:58AM -0800, rand at sent.com wrote:
> > 
> > > i've nginx 1.5.8
> > > 
> > > If I check a config containing
> > > 
> > > 	cat sites/test.conf
> > > 		...
> > > 		location / {
> > > 			proxy_pass  http://VARNISH;
> > > 			include  includes/varnish.conf;
> > > 		}
> > > 		...
> > > 	cat includes/varnish.conf
> > > 		proxy_redirect  default;
> > > 		proxy_connect_timeout  600s;
> > > 		proxy_read_timeout     600s;
> > > 		...
> > > 
> > > I get an error
> > > 
> > > 	nginx: [emerg] "proxy_redirect default" should be placed after
> > > 	the "proxy_pass" directive in
> > > 	//etc/nginx/includes/varnish.conf:1
> > > 	nginx: configuration file //etc/nginx/nginx.conf test failed
> > > 
> > > but if I change to,
> > > 
> > > 	cat sites/test.conf
> > > 		...
> > > 		location / {
> > > 			proxy_pass  http://VARNISH;
> > > +                       proxy_redirect  default;
> > > 			include  includes/varnish.conf;
> > > 		}
> > > 		...
> > > 	cat includes/varnish.conf
> > > -               proxy_redirect  default;
> > > +               #proxy_redirect  default;
> > > 		proxy_connect_timeout  600s;
> > > 		proxy_read_timeout     600s;
> > > 		...
> > > 
> > > then config check returns
> > > 
> > > 	nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
> > > 	nginx: configuration file /etc/nginx/nginx.conf test is
> > > 	successful
> > > 
> > > Why isn't the proxy_redirect viable in the include file?  Intended, or a
> > > bug?
> > 
> > Most likely, there are other uses of the "includes/varnish.conf" 
> > include file in your config, and they cause error reported.
> 
> No, there aren't.  There is only one site enabled, and only one instance
> of includes/varnish.conf, in that site config.

Sorry, but there are no reasons to trust your words more than 
nginx code, at least till you provide full configuration to 
reproduce what you claim see.

Please try checking again (an easy test is to just comment out 
this particular "include" directive, while preserving 
proxy_redirect line in the include file).  If it doesn't help, 
please provide full configuration.

-- 
Maxim Dounin
http://nginx.org/



More information about the nginx mailing list