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!
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 [email protected]
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
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
So is the idea here that you don’t send any image? My concern with that
is the I would think that under some circumstances some browsers may try
more than once to get the image if it got a 204, which would then cause
too many hits to the log (throw off the tracking).
I may try this out but I am still very interested to hear why the
expires 0 does not seem to have an effect with empty_gif. Thanks.
On Oct 29, 2008, at 11:28 PM, Rt Ibmer wrote:
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.
So is the idea here that you don’t send any image? My concern with that
is
the I would think that under some circumstances some browsers may try
more
than once to get the image if it got a 204, which would then cause too
many
hits to the log (throw off the tracking).
Why would they try twice? Only if the href was referenced more than once
on
the page. A 204 is guarenteed by the RFC to be uncachable
I may try this out but I am still very interested to hear why the
expires 0
does not seem to have an effect with empty_gif. Thanks.
http://wiki.codemongers.com/NginxHttpHeadersModule#expires
exipres 0 means Expires: the current date
Which is probably subject to clock skew.
Try
expires epoch;
Cheers
Dave