custom 404 error_page seems to conflict with access_log off

Grégory Pakosz gpakosz at yahoo.fr
Sun Feb 26 19:43:07 UTC 2012


Hello,

In my server block, I configured a custom 404 error page and I tried to
disable access log for /favicon.ico

error_page 404 /404.html;
location = /favicon.ico {
  access_log off;
}

http://pastebin.com/39qXWuq2

It seems that both conflicts.

When favicon.ico is present:
curl -I http://mydomain.com/favicon.ico reports 200 status code and nothing
gets logged into my access log

When favicon.ico is missing:
curl -I http://mydomain.com/favicon.ico reports 404 status code
curl http://mydomain.com/favicon.ico displays my custom 404 html page
and strangely the 404 error gets logged into my access log: "HEAD
/favicon.ico HTTP/1.1" 404 0 "-" "curl/7.19.7 (universal-apple-darwin10.0)
libcurl/7.19.7 OpenSSL/0.9.8r zlib/1.2.3"

When I comment out #error_page 404 /404.html; when favicon.ico is missing:
curl -I http://mydomain.com/favicon.ico reports 404 status code
curl http://mydomain.com/favicon.ico displays nginx's default 404 page
nothing gets logged into my access log

Can someone explain me this behavior?

Thank you,
G.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20120226/d14223d1/attachment.html>


More information about the nginx mailing list