Naming a virtual location to avoid logging results in 404s

Maxim Dounin mdounin at mdounin.ru
Fri Apr 13 15:19:39 UTC 2012


Hello!

On Fri, Apr 13, 2012 at 07:41:33AM -0500, BigdinoWebmaster wrote:

> I'm hosting a forum using Vanilla 
> (http://www.vanillaforums.org), and its internal statistics 
> tracking involves no small amount of GETs and POSTs to URIs that 
> don't correspond to actual directories underneath the web root.  
> Since every active user on the forum generates lots of these 
> every minute, I wanted to exclude them from being logged to keep 
> the server logs from growing to an unreasonable size, and so I 
> added the following three lines to my server config to stop 
> logging of the three main ones:
> 
> location /plugin/imonline { access_log off; log_not_found off; }
> location /dashboard/notifications/inform { access_log off; 
> log_not_found off; }
> location /settings/analyticstick.json { access_log off; 
> log_not_found off; }
> 
> 
> Prior to adding the lines, the requests to those locations would 
> generate an HTTP 200 response and the corresponding analytic 
> action (counting thread views, showing who is online, etc) would 
> be recorded in the forum's database. After adding the lines, all 
> GETs and POSTs receive 404s, like this:

[...]

You should add correct processing to the locations you added as 
well as access_log off, likely something like proxy_pass or 
fastcgi_pass:

    location /plugin/imonline {
        access_log off;
        log_not_found off;
        proxy_pass http://your.backend.host;
        ...
    }

Without this requests which match these locations are processed as 
static, and end up with 404 as there are no corresponding files.

Maxim Dounin



More information about the nginx mailing list