# HttpRefererModule long tail verification

**URL:** <https://www.ruby-forum.com/t/httpreferermodule-long-tail-verification/211118>\
**Category:** NGINX\
**Created:** [August 26, 2011, 1:07am UTC](https://www.ruby-forum.com/t/httpreferermodule-long-tail-verification/211118 "2011-08-26T01:07:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [August 26, 2011, 1:07am UTC](https://www.ruby-forum.com/t/httpreferermodule-long-tail-verification/211118/1 "2011-08-26T01:07:34Z")

</div>

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://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](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)

Posted at Nginx Forum:

> **[HttpRefererModule long tail verification](https://forum.nginx.org/read.php?2,214310,214310#msg-214310)**
>
> 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\\. ~\\.googleuser

---

<div class="post-metadata">

**Author:** ![toddlahman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/a698b9/32.png) [@toddlahman](https://www.ruby-forum.com/u/toddlahman)\
**Post date:** [August 26, 2011, 1:17am UTC](https://www.ruby-forum.com/t/httpreferermodule-long-tail-verification/211118/2 "2011-08-26T01:17:39Z")

</div>

On 8/26/11, toddlahman [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 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):

Sure, there is nothing wrong with long referrers.
