underscores_in_headers not functioning when using default option for listen directive

Maxim Dounin mdounin at mdounin.ru
Mon Dec 27 16:48:18 MSK 2010


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).

> 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



More information about the nginx mailing list