Welcome! Log In Create A New Profile

Advanced

Re: custom 404 error_page seems to conflict with access_log off

Maxim Dounin
February 26, 2012 03:58PM
Hello!

On Sun, Feb 26, 2012 at 08:43:07PM +0100, Grégory Pakosz wrote:

> 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?

Requests are logged in a context of a location where processing ends.

That is, if you have 404 error_page configured requests to a
missing favicon.ico file are internally redirected to /404.html,
and handled in an appropriate location, not in location =
/favicon.ico where you have access_log switched off.

Maxim Dounin

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

custom 404 error_page seems to conflict with access_log off

gpakosz February 26, 2012 02:48PM

Re: custom 404 error_page seems to conflict with access_log off

Maxim Dounin February 26, 2012 03:58PM

Re[2]: custom 404 error_page seems to conflict with access_log off

Max February 26, 2012 05:18PM

Re: custom 404 error_page seems to conflict with access_log off

António P. P. Almeida February 26, 2012 06:10PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 78
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready