How to make empty_gif expire image immediately?

Dave Cheney dave at cheney.net
Thu Oct 30 07:02:20 MSK 2008


try this

location = /files/beacon.gif {
    return 204;
}

see a similar example here:

lucky:~ dcheney$ curl -I http://deadwood.cheney.net/v1
HTTP/1.1 204 No Content
Server: nginx
Date: Thu, 30 Oct 2008 04:01:50 GMT
Connection: keep-alive

Cheers

Dave

 
On Wed, 29 Oct 2008 20:28:06 -0700 (PDT), Rt Ibmer <rtibmx at yahoo.com>
wrote:
> Hi,
> 
> I'm using empty_gif to make a request to a log file for tracking purposes
> (as a beacon).  How can I configure nginx so that the browser is
instructed
> to expire the image immediate (or just to not cache it to begin with).
> 
> I tried this:
> 
>         location /files/beacon.gif {
>                 access_log /tracking.log main;
>                 expires 0;
>                 empty_gif;
>         }
> 
> However when I look at the browser internals for the empty gif it is
marked
> to expire in 1 day instead of 0.  For instance my http analyzer shows the
> image is set to expire on October 30, 2008 which is one day from now.
What
> am I missing? Thanks!





More information about the nginx mailing list