underscores_in_headers not functioning when using default option for listen directive

Sylvain Rabot sylvain.rabot at f-secure.com
Mon Dec 27 17:38:10 MSK 2010


On Mon, 2010-12-27 at 15:48 +0200, Maxim Dounin wrote:
> Hello!
> 
> On Mon, Dec 27, 2010 at 01:21:14PM +0100, Sylvain Rabot wrote:
> 
> > Hi,
> > 
> > We are using nginx 0.7.68 and we encountered a small problem with the
> > underscores_in_headers directive.
> > 
> > Use case, 2 servers section :
> > 
> > server {
> > 	listen 80 default;
> > 	server_name *.domain.com;
> > 
> > 	...
> > }
> > 
> > server {
> > 	listen 80;
> > 	server_name titi.domain-b.com;
> > 	underscores_in_headers on;
> > 
> > 	...
> > }
> > 
> > In that case the underscores_in_headers directive of the second server
> > is not taken care of.
> 
> This is expected.  Header parsing happens in context of default 
> server, before server_name matching (as server_name matching 
> requires parsing Host header).

It makes sense. So shouldn't this directive be in the 'http'
configuration section only ?

> 
> > To make it work we have to either remove 'default'
> > option from the listen directive of the first server or add
> > 'underscores_in_headers on' in the first server as well.
> 
> Just removing "default" from the first server won't help, as first 
> defined server (for the listen socket in question) will be 
> implicitly selected as default anyway.  Otherwise correct.
> 
> Maxim Dounin

-- 
Sylvain <sylvain.rabot at f-secure.com>




More information about the nginx mailing list