I've set up varnish to handle hot linking, but I have an issue with
varnish caching the "hotlink" image for the image request.
Here's the relevant part of default.vcl:
sub vcl_recv {
# Add a unique header containing the client address
remove req.http.X-Forwarded-For;
set req.http.X-Forwarded-For = client.ip;
if (req.request == "GET") {
if ( !(req.http.referer ~ "[a-z0-9]+.domain.com|
yahoo.|rssbandit.org|newsgator.com|google.|search?q=cache" ) &&
(req.http.host ~ "^(raw)?images.domain.") && (req.http.referer) ) {
set req.url="http://images.domain.com/hotlink.gif";
pass;
}
lookup;
}
if (req.request == "PURGE") {
purge_url(req.url);
error 200 "OK!!";
}
}
The problem is this, a user hotlinks http://images.domain.com/puppy.jpeg
and we return hotlink.gif.
Now if a user legitimately loads puppy.jpeg he receives the cached
copy of hotlink.gif in its place.
I though by setting the req.url that the cached file is now
hotlink.gif and we haven't even attempted to store puppy.jpeg in the
cache.
I need to legitimately serve puppy.jpeg even if it's being hotlinked
from somewhere.
Any help would be appreciated.
Thanks
Chris
_______________________________________________
varnish-misc mailing list
[email protected]
http://projects.linpro.no/mailman/listinfo/varnish-misc