Seperate access log for requests without referrers?

Rt Ibmer rtibmx at
Tue May 13 06:28:29 MSD 2008

Hi - I have a need for all requests that come in without a referrer to be logged into a separate log file.  Is this possible? And if so, how?  I see that the access_log can be used within the location block.  The challenge is that I need to do this within a specific location block (and location is anyway based on uri not referrer anyway).

So for instance I want to do something like this:

        location / {

                    if ($http_referrer == "")
                        access_log no_referrer.log myformat;
                        access_log normal.log myformat;

                proxy_pass      http://big_server_com;
                proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;

Is something like this possible and if so how? Thank you!


More information about the nginx mailing list