I am considering the following code to block image hotlinking, while allowing Google images and Page Speed CDN Service access:
location ~ \.(jpg|jpeg|gif|png|ico|flv|mp3|mpg|mpeg)$ {
expires max;
valid_referers blocked ~\.google\. ~\.googleusercontent\.;
if ($invalid_referer) {
rewrite ^ http://www.hollywoodgrind.com/;
}
}
Before I start using this code I'd like to know if it will allow long addresses like the following two examples to properly gather images for use on Google Page Speed (first example), and Google Images (second exampled):
http://4-www-accel-pss.googleusercontent.com/gadgets/proxy?container=accel&gadget=www.toddlahman.com&debug=0&nocache=0&v=sbr54nj4i4l1oeifbfo7j8672k&resize_h=208&resize_w=500&no_expand=1&rooe=1&html_tag_context=img&url=http%3A%2F%2Fwww.toddlahman.com%2Fimages%2F2011%2F1%2Fgoogle-engage-for-agencies-1.jpg
http://www.google.com/imgres?imgurl=http%3A%2F%2Fwww.hollywoodgrind.com%2Fimages%2F2011%2F4%2Fkevin-federline-got-victoria-prince-pregnant-hollywoodgrind-1.jpg&imgrefurl=http%3A%2F%2Fwww.hollywoodgrind.com%2Fkevin-federline-got-victoria-prince-pregnant%2F&usg=__SlV47stVg-9WnrRdrZQxaDCLzXY%3D&h=408&w=450&sz=33&start=0&zoom=1&tbnid=vWSkeiYp1ujo3M%3A&tbnh=146&tbnw=163&ei=9YxWTpT_HaGysAKD06WRDA&itbs=1&iact=hc&vpx=1087&vpy=171&dur=731&hovh=214&hovw=236&tx=147&ty=127&page=1&ndsp=21&ved=1t%3A429%2Cr%3A13%2Cs%3A0&biw=1366&bih=599