Carl Lerche
2006-Aug-05 09:50 UTC
[Mongrel] Apache 2.2 + Mod Proxy Balancer + Mongrel - Hot Linking Protection?
Hey guys, Ok, basically I coded a ruby on rails CMS to manage a bunch of media files. I am finding that a lot of people are "hot linking" to these media files and would like to prevent this to save bandwidth. Usually in the past, it hasn''t been a problem, I would add something like the following to my .htaccess file RewriteEngine on RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://(www.)?domain.com.*$ [NC] RewriteRule .(gif|jpg)$ - [F] However, with my httpd config containing the following lines now: ProxyPass / balancer://mycluster/ ProxyPassReverse / balancer://mycluster/ ProxyBlock images media Options Indexes FollowSymLinks The hotlink protection doesn''t really work anymore. Does anybody know how I could implement this? Thanks, Carl -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060805/0ac483c4/attachment.html
Alexander Lazic
2006-Aug-05 10:08 UTC
[Mongrel] Apache 2.2 + Mod Proxy Balancer + Mongrel - Hot Linking Protection?
Hi, On Sam 05.08.2006 02:50, Carl Lerche wrote:> >Ok, basically I coded a ruby on rails CMS to manage a bunch of media >files. I am finding that a lot of people are "hot linking" to these >media files and would like to prevent this to save bandwidth. Usually >in the past, it hasn''t been a problem, I would add something like the >following to my .htaccess file > >RewriteEngine on >RewriteCond %{HTTP_REFERER} !^$ >RewriteCond %{HTTP_REFERER} !^http://(www.)?domain.com.*$ [NC] >RewriteRule .(gif|jpg)$ - [F] > >However, with my httpd config containing the following lines now: > >ProxyPass / balancer://mycluster/ >ProxyPassReverse / balancer://mycluster/ >ProxyBlock images media >Options Indexes FollowSymLinks > >The hotlink protection doesn''t really work anymore. Does anybody know >how I could implement this?Where in your config are the Proxy*-Directives, in a Location/Director-Tag or in Global? I think this is a question for the httpd-users list, imho. Regards Alex
Zed Shaw
2006-Aug-05 16:41 UTC
[Mongrel] Apache 2.2 + Mod Proxy Balancer + Mongrel - Hot Linking Protection?
On Sat, 2006-08-05 at 02:50 -0700, Carl Lerche wrote:> Hey guys, ><snip>> RewriteEngine on > RewriteCond %{HTTP_REFERER} !^$ > RewriteCond %{HTTP_REFERER} !^http://(www.)?domain.com.*$ [NC] > RewriteRule .(gif|jpg)$ - [F] ><snip>> The hotlink protection doesn''t really work anymore. Does anybody know > how I could implement this?I''m pretty sure that''ll still work, but you''ll want to turn on the mod_rewrite debugging to see what happens. -- Zed A. Shaw http://www.zedshaw.com/ http://mongrel.rubyforge.org/ http://www.railsmachine.com/ -- Need Mongrel support?
Dave Murphy
2006-Aug-06 09:12 UTC
[Mongrel] Apache 2.2 + Mod Proxy Balancer + Mongrel - Hot Linking Protection?
On 05/08/06, Carl Lerche <carl.lerche at verizon.net> wrote:> The hotlink protection doesn''t really work anymore. Does anybody know how I > could implement this?I had a similar problem when I re-configured my server to use Apache + mod_proxy + mongrel. I had some rewrite rules to handle feeds (re-directed to Feedburner), page caching (inspired by Coda''s howto) and links from my previous blog engine. I couldn''t get re-write to work until I dropped the ProxyPass lines and put the following in: RewriteRule ^/(.*)$ http://localhost:3000%{REQUEST_URI} [P,QSA,L] Now the all the other rewrite rules work as intended, and mongrel still handles dynamic queries. Cheers, -- Dave Murphy (Schwuk) http://schwuk.com