Forum Moderators: phranque

Message Too Old, No Replies

Disconnecting a specific computer from my site

I need a "timeout" for IPs connected for 24 hours or more!

         

Wizcrafts

6:36 pm on Oct 19, 2003 (gmt 0)

10+ Year Member



I have a situation where one party has been continuously connected to one webpage for 5 days in a row. They are slowly but surely sucking up my bandwidth by reloading ad banners and html code on a one minute basis. This occurs because I have a javascript reload of my rotating ad banners every 60 seconds. While I could write a non-rotating ad header for the page in question, I'd rather solve the excessive usage problem first.

The source computer is at the same IP at "office-gw.centreweb.com" just in case anybody else is seeing this behavior recently.

I have just written a short disconnected notice and am redirecting the IP to it, successfully. Does anybody know of a method I can use to actually disconnect this computer from my website, rather than redirecting them to the notice?

This is probably a student or office worker who inadvertantly left their browser open on my webpage. I don't really want to ban him/her, but don't know what else to do. Is there a way I establish a timeout for any connection, so that future excessive connections, say 24 continuous hours, can be automatically terminated?

My OSs: Apache and Linux on a Raq4.
Thnx, Wiz

[edited by: DaveAtIFG at 7:53 pm (utc) on Oct. 19, 2003]
[edit reason] Started new thread, deleted "May be OT" comment [/edit]

jdMorgan

7:16 pm on Oct 20, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Wiz,

This thread points out a distinction that needs to be made in order to understand the problem: In an HTTP sense, a "connection" starts with a user-agent request, and ends with the server response. The server has no knowledge that a "session" is active - you can add a layer of code above the server to track sessions, but the server itself does not maintain information from one request/response to the next.

What this means is that each request for an html page, an image, a script, or CSS file, etc., exists on its own - You can often see the different users' browsers will load page elements in a different order, which hints at the behaviour.

So, this user is "connected" only because the page his browser has rendered contains a script, and that script issues a page reload every 60 seconds. But this reload is a new "connection" and the server won't know that it is related to the previous page load. The page, once reloaded, will call for new banners, and each of those is a new and separate request as well.

As far as solutions, you have two avenues open: server-side and client-side. On the server side, you can use various techniques to track sessions and redirect the user to a static page after a fixed time, just as one example. This could involve a session ID, a tracking cookie, and for the simplest cases, tracking the user by IP number - although this last won't work with many ISPs which use proxy caches and may assign a different IP to each user request - A recent post about AOL users' IP addresses described this.

Client-side, you can modify the script to stop rotating and/or reloading after 10 minutes or so. I think that would be the easiest way to do it, myself.

Jim

lorax

7:32 pm on Oct 20, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Well said jdMorgan.

I had a client who added a flash file to their page - which made calls to a dbquery script every 10 minutes. They had the same issue - I had the same answer.

ogletree

7:41 pm on Oct 20, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Actually the script they have open is on there machine and there is nothing you can do until they close that browser and reload it. You can not make changes to what is on his machine. If that person closes their browser and reopens it they will get the new script but until then you could only ban them.

Wizcrafts

7:43 pm on Oct 20, 2003 (gmt 0)

10+ Year Member



Thanks Jim, Lorax and ogletree.

I will modify the banner script as suggested. I am already redirecting this client to a special page consisting of only 240 bytes (at this moment). At least this won't break the bandwidth bank as fast as whole page reloads. I sent a message to their hosting supplier, but haven't received any reply yet. I am also looking into getting a temporary IP block at my host's server level, and will find out about that later today. I hope that eventually somebody closes that browser and lets my server idle for a while.

Wiz

jdMorgan

8:03 pm on Oct 20, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



ogletree,

I based that assumption on this statement, interpreting it to mean that the entire page was reloaded. If the banner script is in an external .js file, however, it will be cached, and what you say will be true.

> sucking up my bandwidth by reloading ad banners and html code on a one minute basis.

Nasty problem, this one... :(

Jim

Wizcrafts

8:24 pm on Oct 20, 2003 (gmt 0)

10+ Year Member



It is an external js file
;-(

ogletree

8:28 pm on Oct 20, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I figured that was the case from

I have a javascript reload of my rotating ad banners every 60 seconds.

Wizcrafts

3:26 pm on Oct 22, 2003 (gmt 0)

10+ Year Member



This 60 second request cycle continues to persist. It is now 8 days into the non-stop reload of a cached javascript and it seems that redirecting to my own custom message had no effect. Nobody is manning that computer, and I believe it is an intentional harrassment attack. I have decided to redirect this person or bot-script back to his/its own IP, using:

RewriteCond %{REMOTE_ADDR} ^12\.XXX\.22\.235$
RewriteRule .* http://12.XXX.22.235 [L]

Can anybody show me the syntax to include 301 permanent in the [L] switch? I think it goes [L=301] but I'm not sure and don't want to cause server errors with a bad command.
I'm trying things to fool the browser into thinking the scripts have moved permanently elsewhere. I even tried redirecting him/it to a phoney set of pages and scripts, hoping that the new scripts would overwrite the old ones, to no avail. Also, the webmaster at their hosting company did not respond to my requests for assistance with this. This all revolves around www.centreweb.com and a host calling itself "Centre Of The Web." The computer that is harrassing me is pinned to "office-gw.centreweb.com" with an IP of 12.XXX.22.235, both of which give a generic page not found when queried with my browser.

Any other suggestions would be welcomed.

Wiz

[edited by: DaveAtIFG at 3:41 pm (utc) on Oct. 22, 2003]
[edit reason] Neutered IPs [/edit]

ogletree

3:31 pm on Oct 22, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



The best thing you can do is ban the ip from the firewall or on the server nic itself. I know how to do it on MS servers but not non-MS.

closed

4:00 pm on Oct 22, 2003 (gmt 0)

10+ Year Member



[R=301,L]

Wizcrafts

4:08 pm on Oct 22, 2003 (gmt 0)

10+ Year Member



Thanx for the 301 syntax Closed

closed

4:32 pm on Oct 22, 2003 (gmt 0)

10+ Year Member



You're welcome, Wizzo. ;)

Wizcrafts

10:45 pm on Oct 22, 2003 (gmt 0)

10+ Year Member



This problem has a happy ending.

I received a reply from the company whose computer has been connected to my website for 8 days and they have closed the browser that was open to my webpage which contains a rotating banner script. It was inadvertant on their part and they apologized for the inconvenience.

Now I have to fix the script to run thru once then halt on the last banner...

Wiz