How to make empty_gif expire image immediately?

Sean Allen sean at
Tue Nov 4 01:32:34 MSK 2008

On Oct 29, 2008, at 11:28 PM, Rt Ibmer 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!

expires -1;

works like a charm for me.

More information about the nginx mailing list