[PATCH] Normalizing the Host: header

Adrian Otto aotto at mosso.com
Sat Mar 12 00:05:45 CET 2011


Some advice in-line:

On Mar 11, 2011, at 2:39 PM, Poul-Henning Kamp wrote:

> In message <4D7A7A4F.3030109 at schokola.de>, Nils Goroll writes:
> 
>> can we come to a conclusion of this discussion?
> 
> What bothers me is the "magic" aspect of this kind of stuff.
> 
> Where does the magic intuitively begin and end ?
> 
> Should we also case fold anything compared to or matched to the
> host header ?
> 
> What about host part of Location headers ?
> 
> Where does the magic end ?

In this case, I offer the advice that all host related headers should be case folded, because DNS naming is case insensitive. So essentially anywhere Varnish handles a hostname for any comparison, it should follow the same rules.

> I very much prefer to make these things explict and consistent,
> so that people see them happen and know where they happen.
> 
> ... but I also don't want to clutter up default.vcl with "mandatory stuff".

That's why it's a good idea to build this in as default behavior. If it costs any meaningful performance penalty to do it, then consider using a run-time configuration variable.

>> - case-folding once in-place does not use any additional session space
>> as case-folding in VCL would
> 
> In my mind, this is probably the best argument for doing it,
> I am just not sure it convinces me.
> 
> Next issue which comes right behind is: Should we also
> normalize URL's by reducing pointless %xx and other escapes ?

Yes, escapes should also be reduced to the lowest common denominator.

> Are there any other kinds of request normalization we should do ?
> 
> And should we also normalize backend responses ?

Yes, in the same way, as those may be used for comparisons also.

Adrian



More information about the varnish-dev mailing list