Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am using haproxy and nginx. Haproxy has sthis option to check health of my backends:

option httpchk HEAD /lol.txt HTTP/1.0

All works fine, but I do not want to log this health check

So in my nginx configuration I add:

    location /lol.txt {
    access_log off;
    }

The problem is, this location returns a 301, so I got these logs again and again:

 10.1.29.1 - - [15/Mar/2013:06:51:36 +0100] "HEAD /lol.txt HTTP/1.0" 301 0 "-" "-"

Have you some idea to have the access_log off working?

Regards.

share|improve this question
4  
There's no rewrite directive in that location block, so it can't be being used. Please provide the rest of your configuration. –  mgorven Mar 15 '13 at 20:00

1 Answer 1

You probably have some other location that handles the request, and your access_log doesn't apply, or maybe it gets overwritten by another access_log directive.

Try the following if you want to disable passing these requests to the backend:

location = /lol.txt {
    access_log off;
    return 'It works!' 200;
}

Or, alternatively, if you still must pass the request to be backend:

if ($request_uri = /lol.txt) {
    access_log off;
}

It might also help to try to make sure that these access_log off appear after any other access_log directives, e.g. see if moving it around makes a difference.

Hope it helps, and please report what worked!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.