Forum Moderators: phranque
So, I am using Apache to proxy pass back to another server behind Apache and I use virtual hosts to do so. I would like Apache to block any hotlinking of images but everything I read or have found is for .htaccess file and not for httpd.conf
Why does this not work?
<VirtualHost 11.1.1.1.1:80>
ServerName www.domain.com
RewriteEngine on
RewriteCond %{HTTP_REFERER}!^$
RewriteCond %{HTTP_REFERER}!^http://domain.com/.*$ [NC]
RewriteCond %{HTTP_REFERER}!^http://www.domain.com/.*$ [NC]
RewriteRule ./*\.(gif¦GIF¦jpg¦JPG)$ - [F]
ProxyPass / [11.11.11.11:8080...] etc....
</VirtualHost>
Any help would be very and highly appreciated.
BZ
<VirtualHost 11.1.1.1.1:80>
ServerName www.domain.com
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_REFERER} .
RewriteCond %{HTTP_REFERER} !^http://(www\.)?domain\.com [NC]
RewriteRule \.(gif¦jpg)$ - [NC,F]
ProxyPass / http://11.11.11.11:8080/ etc....
</VirtualHost>
Jim
Since no-one else here seems to have tried this configuration, I'll throw out a few suggestions:
First, replace the mod_rewrite code with the equivalent mod_access code. It is possible that it may then be processed before the mod_proxy directives -- I don't know. Something like:
SetEnvIfNoCase Referer "^http://(www\.)?mydomain\.com" allowimages
SetEnvIf Referer "^$" allowimages
<FilesMatch "\.(gif¦jpg)$">
Order Allow,Deny
Allow from allowimages
</FilesMatch>
An interesting problem -- I wish I knew more about this configuration.
Jim