Blocking externally linked images with Mongrel proxy setup

Denis F. Latypoff denis at
Tue Sep 11 14:34:12 MSD 2007

Hello Dan,

Tuesday, September 11, 2007, 5:19:02 PM, you wrote:

> Hi Everyone,

> Im using the standard rails/mongrel config script
> ( 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)$ {
+ 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,

Best regards,
 Denis                            mailto:denis at

More information about the nginx mailing list