Welcome! Log In Create A New Profile

Advanced

Re: Custom error pages and access_log inheritance

Francis Daly
October 02, 2015 08:38AM
On Fri, Oct 02, 2015 at 07:30:28AM -0400, bjoe2k4 wrote:

Hi there,

> i was wondering if it is possible to have custom error pages *without* the
> error page locations inheriting the http or server level access_log
> directives.

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

So if your custom error page is handled in the same location that the
initial request is handled in, you'll use the same access_log.

> location ~ \.html$ {
> access_log /app/log/html.log custom;
> }

> All access logs for requests "/exists.html" with status code 200 and
> "/nonexists.html" with status code 404 are in the html.log file.

The two requests are handled in the same location, and there are no
internal redirects to a different location.

> The access logs for "/nonexists.html" are now located in the file
> "test.log", which makes perfect sense, since the server level access_log
> directive is inherited by location /x. The only way to fix this is a
> somewhat lengthy config like this:

"error_page 404 /404.html;" ?

> 2) all the access logs stay in the inital location's access_log,

That's not what nginx does.

http://nginx.org/en/docs/http/ngx_http_log_module.html

I think that you would have to come up with one error_page per "normal"
location, then create a new location for each error_page, that had the
same access_log configuration as the location it came from.

Or have the error_page value be handled in the same location that it is
configured in.

Good luck with it,

f
--
Francis Daly francis@daoine.org

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

Custom error pages and access_log inheritance

bjoe2k4 October 02, 2015 07:30AM

Re: Custom error pages and access_log inheritance

Francis Daly October 02, 2015 08:38AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 236
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