how to force nginx do return 204 and log it into access log?

theromis1 nginx-forum at nginx.us
Wed Apr 28 04:52:07 MSD 2010


Hi,

I'm trying to implement logic which apache making return status 204 instead of 200 and log it into access log.
It doing "RedirectMatch 204 xxxxx.gif$"
for nginx I have created this part of config which working very close to above:
[code]
        if ( $request_uri ~ xxxxx.gif ) {
              return 204;
        }
        location ~ xxxx.gif {
            log_format special-v4 "$msec\t$args\t$http_cookie";
            access_log /path/to/access.log special-v4;
            empty_gif;
            internal;
        }
[/code]

so it works but not writing into log.

[code]
Next one writing into log but not giving response 204:
        location ~ xxxx.gif {
            log_format special-v4 "$msec\t$args\t$http_cookie";
            access_log /path/to/access.log special-v4;
            empty_gif;
            internal;
            return 204;
        }
[/code]

My question: is it possible to have ability write access log and have retcode 204 without binary modification custom modules?

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,80140,80140#msg-80140




More information about the nginx mailing list