Forum Moderators: phranque

Message Too Old, No Replies

Help with rewrite rule, block referer.

         

hendra

3:25 pm on Aug 18, 2005 (gmt 0)

10+ Year Member



How can i block a game server address? Running a half-life 2 game server, i have it set to only alow referers from a certain ip(I've put * only to show on here). It seems to work to a degree, the game maps can only be downloaded if the referer has come from the ip address(maps are d/l'd via the game). I thought that would do it but i notice in my web usage referers I have some site that show hl2://*.*.*.* (different ip), mostly 192.168.*.* and one known game server. So how can I stop the other ip addresses?

RewriteEngine on
RewriteCond %{HTTP_REFERER}!^$
RewriteCond %{HTTP_REFERER}!^hl2://*.*.*.* [NC]
RewriteRule \.(gif¦jpe?g¦png¦bz2¦bsp)$ - [F,NC,L]

hendra

10:58 pm on Aug 19, 2005 (gmt 0)

10+ Year Member



ok noone knows the answer?

jdMorgan

5:32 am on Aug 20, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I personally don't know anything about game servers, so your question is not clear and I can only guess.

Do you want to block another server from accessing your server, or do you want to block clients referred to your server from some other game server?

The former requires %{REMOTE_ADDR} or %{REMOTE_HOST}, while the latter uses %{HTTP_REFERER}.

Note that the use of %{REMOTE_HOST} requires your server to request -and wait for- a reverse-DNS lookup on the IP address. Therefore, these can slow down your server badly. If you must use %{REMOTE_HOST} lookups, be careful to limit the scope as much as possible, so that these lookups are only done when absolutely necessary.

Jim

hendra

5:37 pm on Aug 20, 2005 (gmt 0)

10+ Year Member



I want to block another game server form downloading maps from my http space, basically the server uses something called sv_downloadurl "http://www.example.com/hl2mp/" Now all another server has to do is put that in their server cfg file and leech the files/bandwidth. What i don't understand is why im getting referers from other game servers if i have it only to allow from my server. To test it I changed the ip address in my htacess file and then tested to see if it would let me download the maps, it didn't which is good and makes me wonder how i'm getting some servers in my refer list usage for my website. SO I need some way of blocking those particualr referes aswell.

hendra

5:59 pm on Aug 20, 2005 (gmt 0)

10+ Year Member



I also tried this after my rewrite rule but it also blocks my server too for some reason.

<Limit GET>
order allow,deny
allow from all
deny from hl2://192.168.
</Limit>

jdMorgan

6:54 pm on Aug 20, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Even if you block a server from fetching your content using %{REMOTE_ADDR} or prevent it from showing your content by including it on their pages for the user's browser to fetch using %{HTTP_REFERER}, you will always see the accesses in your logs. What matters is whether you see a 200-OK or 403-Forbidden response in your logs.

We need to tighten up the technical terms and be very specific here, because it's still hard to tell whether another server is fetching your content, or just including it on their pages (for example as <HREF>s in <IMG> tags) so the the client browsers load it.

Jim

hendra

7:17 pm on Aug 20, 2005 (gmt 0)

10+ Year Member



I see, i had just assumed that because they were showing as refered that they had access. Checking my logs i see my server is showing the last 100 lines in my log, obviously that's not enough as the server's quite busy so I would need to increase that so long as it doesn't affect performance if the log is too big.

hendra

7:21 pm on Aug 20, 2005 (gmt 0)

10+ Year Member



Ammend that, i just need to look in error log file.