Forum Moderators: phranque
I have found several logs like this one:
www.mydomain.org 213.xx.xx.**** - - [05/Aug/2004:16:57:48 -0400] "CONNECT login.icq.com:443 HTTP/1.0" 302 212 "-" "-"
they are trying to use my server as proxy? correct?
is it right to add the following rewrite to make 'em stop?
RewriteCond %{THE_REQUEST} ^GET\ http [NC,OR]
Thanks in advance
You can try this:
# BLOCK unsupported HTTP methods
RewriteCond %{REQUEST_METHOD} !^(GET¦HEAD¦OPTIONS¦POST¦PROPFIND¦TRACE)$
RewriteRule .* - [F]
# BLOCK attempts to use our server as a proxy, but allow absolute URIs (change example.com to your domain)
RewriteCond %{THE_REQUEST} ^(GET¦HEAD¦POST)./?http:// [NC]
RewriteCond %{THE_REQUEST} !^(GET¦HEAD¦POST)./?http://(www\.)?example\.com/
RewriteRule .* - [F]
Jim
Please I have a question about:
RewriteCond %{REQUEST_METHOD}!^(GET¦HEAD¦OPTIONS¦POST¦PROPFIND¦TRACE)$
I'm already using:
RewriteCond %{REQUEST_METHOD}!^(GET¦HEAD¦POST) [NC,OR]
it will becomes reduntant while placing the new one you suggest? will I have to take it away?
also I see it ends with $
if it's not the last rewrite of my list i will have to add [NC,OR] after $
correct?
I'm quite confused about the second example you provide;
# BLOCK attempts to use our server as a proxy, but allow absolute URIs (change example.com to your domain).
can you please explain me what does it mean allowing absolute URIs? there's a risk in allowing absolute URIs?
Anyway, could be enough to place just the
# BLOCK unsupported HTTP methods
to stop that "CONNECT login.icq.com:443 HTTP/1.0"?!?
Do You think it will be better to place both of them?
Thank you so much for your explanations
tito
> it will becomes reduntant while placing the new one you suggest? will I have to take it away?
You won't *have to* remove it, no. Use my code as an example to make yours work. Please see our charter for links to learn more about mod_rewrite.
> also I see it ends with $
> if it's not the last rewrite of my list i will have to add [NC,OR] after $, correct?
The "$" ends the pattern, because the pattern requires an exact match. You can use the code exactly as I posted it, independent of your other code. Or you can combine it with your code as you see fit. There is no need to use [NC], though, because REQUEST_METHOD is required to be uppercase by the HTTP protocol.
> I'm quite confused about the second example you provide;
> # BLOCK attempts to use our server as a proxy, but allow absolute URIs (change example.com to your domain).
> can you please explain me what does it mean allowing absolute URIs? there's a risk in allowing absolute URIs?
If you install that code, then
"GET [yourdomain.com"...] is allowed, and is called an absolute URI, but
"GET [someotherdomain.com"...] is not allowed, because it is an attempt to use your server as a proxy.
> Anyway, could be enough to place just the
> # BLOCK unsupported HTTP methods
> to stop that "CONNECT login.icq.com:443 HTTP/1.0"?!?
>
> Do You think it will be better to place both of them?
I posted the code because I thought it might be useful to you. Use it if you need it.
Jim
if LoadModule directive into my httpd.conf are those listed on top of it, where it says:
# Documentation for modules is in "/home/httpd/manual/mod" in HTML format.
LoadModule env_module modules/mod_env.so
LoadModule define_module modules/mod_define.so
...etc..
I cannot see any proxy module.
not even where it says: Extra modules...
so it shouldn't be loaded any proxy module, correct?
the fact that I've got a 302 code response (redirect) could mean that the request was sent to an error page somehow?
Thanks for your suggestion
tito
That's strange,
my 404 is properly working, I can see it by my logs and by calling files that does not exist on my server.
This is a skip of my htaccess incl. the error404 directive:
ErrorDocument 401 /401.php
ErrorDocument 403 /403.php
ErrorDocument 404 /404.php
ErrorDocument 500 /500.php
SetEnvIf Request_URI "(403\.php¦robots\.txt)$" allowit
Order Deny,Allow
deny from 128.****.xx.xx
etc...
Allow from env=allowit
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{THE_REQUEST} ^(GET¦HEAD¦POST)./?http:// [NC]
RewriteCond %{THE_REQUEST}!^(GET¦HEAD¦POST)./?http://(www\.)?mydomain\.tld/
RewriteRule!403\.php$ - [F]
Please, my 404.php page has a couple of <? include('file.txt')?> in it (in common with all other pages on the site), do you believe that this could cause the 302 response?
Thanks in advance for your help,
tito