You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by rott <ro...@buckeye-express.com> on 2004/03/21 04:41:54 UTC
[users@httpd] Protecting Your Images
Im using apache 2.0.47 on a win2000 Pro computer and I want to protect my
gif's and jpeg's I found this nice code for doing that but every time I
start apache I get and error from apache
RewriteCond: bad flag delimiters
the code is found here
http://www.serverwatch.com/tutorials/article.php/10825_1132731_4
SetEnvIfNoCase Referer !"^http://my.apache.org/" not_local_ref=1
SetEnvIfNoCase Request_URI ".(gif|jpg)" is_image=1
RewriteEngine On
RewriteCond $ {ENV:not_local_ref} =1
RewriteCond $ {ENV:is_image} =1
RewriteRule .* - [Last,Env=poach_attempt:1]
CustomLog logs/poachers_log CLF env=poach_attempt
I have googled for it and found some things but nothing that really helped
me fix it
Dale
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Protecting Your Images
Posted by "Jack L. Stone" <ja...@sage-one.net>.
At 10:39 PM 3.21.2004 -0500, you wrote:
>
>On Sun, 21 Mar 2004, Jack L. Stone wrote:
>> Joshua: That was/is very useful info and I have the "FilesMatch" part
>> working well. But, I thought I'd add the logging feature too, but I must
>> hve something wrong on that one. It creates the "poachers.log" just fine,
>> but nothing is logged. I figured it might be the "RewriteRule" flags just
>> above the last line for the "CustomLog" line.
>>
>
>A couple points:
>
>1. If you want help, you'll need to show *exactly* what configuration you
>are using, along with relevant log entries. You'll probably also need to
>active the RewriteLog to see what mod_rewrite is doing. (See the
>mod_rewrite docs.)
>
>2. Do you really need this poachers.log? What do you expect to get out of
>it, and can't you get that same information by looking through your
>existing error and access logs?
>
>3. I probably wouldn't mix mod_rewrite and mod_setenvif like that, because
>you get into trouble if the modules run in the wrong order. I would
>either do it entirely in mod_rewite, as in:
>
>RewriteEngine On
>RewriteCond ${HTTP_REFERER} ^http://my\.apache\.org/
>RewriteRule .*\.(gif|jpg) - [F,L,env=poach:1]
>CustomLog logs/poachers_log combined env=poach
>
>or I'd do it entirely with mod_setenvif:
>
>SetEnvIfNoCase Referer "^http://my\.apache\.org/" local_ref=1
><FilesMatch "\.(gif|jpg)">
> Order Allow,Deny
> Allow from env=local_ref
> SetEnvIf local_ref 1 poach=1
></FilesMatch>
>CustomLog logs/poachers_log combined env=poach
>
>Joshua.
>
Being my first time to use this technique, I was curious to see what useful
info the logs might present as a separate log file. Indeed, while I
experimented last night, I found that the info in the error log was very
revealing and sufficient.
I tried your method doing it entirely with mod_setenvif and it worked fine,
but remeoved that as the <FileMatch> is really enough for my needs.
Many thanks for your advice, Joshua!
Best regards,
Jack L. Stone,
Administrator
SageOne Net
http://www.sage-one.net
jackstone@sage-one.net
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Protecting Your Images
Posted by Joshua Slive <jo...@slive.ca>.
On Sun, 21 Mar 2004, Joshua Slive wrote:
> RewriteEngine On
> RewriteCond ${HTTP_REFERER} ^http://my\.apache\.org/
> RewriteRule .*\.(gif|jpg) - [F,L,env=poach:1]
> CustomLog logs/poachers_log combined env=poach
Of course, you'd need a ! in front of the ^http://... to get negation.
I never claimed I tested these...
Joshua.
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Protecting Your Images
Posted by Joshua Slive <jo...@slive.ca>.
On Sun, 21 Mar 2004, Jack L. Stone wrote:
> Joshua: That was/is very useful info and I have the "FilesMatch" part
> working well. But, I thought I'd add the logging feature too, but I must
> hve something wrong on that one. It creates the "poachers.log" just fine,
> but nothing is logged. I figured it might be the "RewriteRule" flags just
> above the last line for the "CustomLog" line.
>
A couple points:
1. If you want help, you'll need to show *exactly* what configuration you
are using, along with relevant log entries. You'll probably also need to
active the RewriteLog to see what mod_rewrite is doing. (See the
mod_rewrite docs.)
2. Do you really need this poachers.log? What do you expect to get out of
it, and can't you get that same information by looking through your
existing error and access logs?
3. I probably wouldn't mix mod_rewrite and mod_setenvif like that, because
you get into trouble if the modules run in the wrong order. I would
either do it entirely in mod_rewite, as in:
RewriteEngine On
RewriteCond ${HTTP_REFERER} ^http://my\.apache\.org/
RewriteRule .*\.(gif|jpg) - [F,L,env=poach:1]
CustomLog logs/poachers_log combined env=poach
or I'd do it entirely with mod_setenvif:
SetEnvIfNoCase Referer "^http://my\.apache\.org/" local_ref=1
<FilesMatch "\.(gif|jpg)">
Order Allow,Deny
Allow from env=local_ref
SetEnvIf local_ref 1 poach=1
</FilesMatch>
CustomLog logs/poachers_log combined env=poach
Joshua.
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Protecting Your Images
Posted by "Jack L. Stone" <ja...@sage-one.net>.
At 10:56 PM 3.20.2004 -0500, you wrote:
>
>On Sat, 20 Mar 2004, rott wrote:
>
>> Im using apache 2.0.47 on a win2000 Pro computer and I want to protect my
>> gif's and jpeg's I found this nice code for doing that but every time I
>> start apache I get and error from apache
>> RewriteCond: bad flag delimiters
>
>No need to post the same question three times. Especially when I answered
>it the first time:
>http://marc.theaimsgroup.com/?l=apache-httpd-users&m=107971312428267&w=2
>
>Joshua.
>
Joshua: That was/is very useful info and I have the "FilesMatch" part
working well. But, I thought I'd add the logging feature too, but I must
hve something wrong on that one. It creates the "poachers.log" just fine,
but nothing is logged. I figured it might be the "RewriteRule" flags just
above the last line for the "CustomLog" line.
These are being placed in the vhost container.
Running Apache-1.3.27 on FBSD-4.8.
Any further tips appreciated! Thanks in advance.
PS: This is my first use of the mod_rewrite
Best regards,
Jack L. Stone,
Administrator
SageOne Net
http://www.sage-one.net
jackstone@sage-one.net
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Protecting Your Images
Posted by rott <ro...@buckeye-express.com>.
sorry i never got it i thought it never made it threw and i didnt see your
reply to it sorry
----- Original Message -----
From: "Joshua Slive" <jo...@slive.ca>
To: <us...@httpd.apache.org>
Sent: Saturday, March 20, 2004 10:56 PM
Subject: Re: [users@httpd] Protecting Your Images
>
> On Sat, 20 Mar 2004, rott wrote:
>
> > Im using apache 2.0.47 on a win2000 Pro computer and I want to protect
my
> > gif's and jpeg's I found this nice code for doing that but every time I
> > start apache I get and error from apache
> > RewriteCond: bad flag delimiters
>
> No need to post the same question three times. Especially when I answered
> it the first time:
> http://marc.theaimsgroup.com/?l=apache-httpd-users&m=107971312428267&w=2
>
> Joshua.
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> " from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
>
>
> __________________________________________________________
> This message was scanned by GatewayDefender
> 11:06:17 PM ET - 3/20/2004
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Protecting Your Images
Posted by Joshua Slive <jo...@slive.ca>.
On Sat, 20 Mar 2004, rott wrote:
> Im using apache 2.0.47 on a win2000 Pro computer and I want to protect my
> gif's and jpeg's I found this nice code for doing that but every time I
> start apache I get and error from apache
> RewriteCond: bad flag delimiters
No need to post the same question three times. Especially when I answered
it the first time:
http://marc.theaimsgroup.com/?l=apache-httpd-users&m=107971312428267&w=2
Joshua.
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org