Condition to match a missing "Host:" header
Luigi Perroti
luigi.perroti at googlemail.com
Thu Aug 21 21:21:38 MSD 2008
Igor Sysoev <is at ...> writes:
>You need just:
>
>location = /400.html {
> root /www/errors;
> internal;
> access_log /var/log/nginx/access.log;
>}
Unfortunately, if I do that the 400 responses that my application sends get
logged too. Which I would prefer to avoid.
>BTW, in 0.7.12 the special server_name "" will allow to handle
>requests without Host not in default listening server:
>
> server {
> listen 80 default;
> server_name _;
> }
>
> server {
> listen 80;
> server_name www.example.com "";
> }
Does that mean that if ($host = "") would evaluate to true if no Host: header is
sent? That would precisely be what I need.
-Luigi
More information about the nginx
mailing list