proxy_intercept_errors and logging

mikeyk nginx-forum at
Fri Jan 13 19:47:00 UTC 2012

Hi there,

We have nginx proxying to a bunch of django upstreams.

When those upstreams throw an error, we use proxy_intercept_errors to
show a custom page. The problem is that this causes those 500s to be
logged into the global access_log, rather than the access_log specified
for that location. Here is a (reduced) example:

    # at the server 
    access_log /logs/nginx/access.log accesslogformat;
    proxy_intercept_errors on;
    location ~ ^/oauth.*$ {
        proxy_pass        http://appservers;

        access_log /logs/nginx/app.log applogformat;

Is there a way to get errors to log to the app.log in this case, even
with proxy_intercept_errors to on? Right now we get all the 500s in the

Thanks in advance!

Posted at Nginx Forum:,221201,221201#msg-221201

More information about the nginx mailing list