Blocking externally linked images with Mongrel proxy setup

Dan Webb dan at danwebb.net
Tue Sep 11 14:19:02 MSD 2007


Hi Everyone,

Im using the standard rails/mongrel config script
(http://wiki.codemongers.com/NginxRubyonRailsMongrel) for a rails site
but Im trying to block images from being linked from other sites.

It looks like something like this is supposed to do it:

location ~* \.(gif/jpg/png/swf/flv)$ {
 valid_referers none blocked mydomain.coml;

 if ($invalid_referer) {
  return 403;
 }
}

But when I insert this inside the server block (after the location
/50x.html) line all my images come up as 404 when requested via the
site....any ideas how to fix this?

In fact, even if I put that location block in with nothing in it at
all it 404s my images...

do I need to set home for each location or something?

Thanks in advance,

-- 
Dan Webb
http://www.danwebb.net

Event Wax (http://www.eventwax.com)





More information about the nginx mailing list