You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Jonesy <gm...@jonz.net> on 2014/01/01 04:10:41 UTC

[users@httpd] Re: Making delay in apache

On Tue, 31 Dec 2013 23:01:00 +0330, Ali Majdzadeh wrote:
>
> Jonesy,
> Of course, but does this make any difference if you force Apache not to
> process requests for a specified amount of time?

If you are going to take a web site offline, you should serve up 
something besides 404's, or "domain unreachable" -- unless it's 
just a vanity|hobby web site, I suppose.

 503 Service Unavailable
    The server is currently unavailable (because it is overloaded 
    or down for maintenance).[2] Generally, this is a temporary state. 

Jonesy


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re: Making delay in apache

Posted by samaneh berenjian <sa...@aut.ac.ir>.
hi dear users,
Actually these solutions are not something that i really want. If i block the incoming port for few seconds or make the service unavailable, Maybe a victim user do not try to send her/his request again. Something that i want is whenever a request comes i make a delay something like that the user thinks that  the server is not fast to replies, but not completely refuse the connection and request fr seconds. I mean i want the user request to be in a stable status till i decide in his/her request. How can i implement such a scenario? Another thing is that i use modsecurity as a firewall and there is a filter on modsecurity to use an external script. Do you know how can i write a perl or bash script that with it i can do something like this?One of users write a perl script for such a purpose but i do not exactly if it could be useful or not. the code and its description is here:
In conf.d/perl.conf add this line:
PerlInitHandler MyDelay

Contents of MyDelay.pm are as follows:

package MyDelay;

# This package can be used in conjunction with a
# PerlInitHandler directive to slow down a connection
# based on an ip address

# Example: set in perl.conf
# To slow down a particular request
#<Location /delay_test.html>
#   PerlInitHandler MyDelay
#</Location>
#
# or outside of any Location, File, etc to slow down all requests
#  PerlInitHandler MyDelay

use strict;
use Apache2::RequestRec;
use Apache2::Const;             # for OK
use Apache2::Connection;		# for remote_ip

sub handler
{
    my $r = shift;
    my($c);
    my($ip_addr);

    $c = $r->connection;
    $ip_addr = $c->remote_ip;
    if ($ip_addr eq "my ip address")
    {
       print STDERR ("in MyDelay:handler\n");
       print STDERR ("ip_addr = $ip_addr\n");
       sleep (30);
    }

    return OK;
}

1;

I do not know exactly that it could be a useful perl script for such a purpose. Is anyone aware of usefulness of such script to make apache slow to respond to a request?
I really need your help,Best Regards

On Wed, 01/01/2014 06:40 AM, Jonesy &lt;gmane@jonz.net&gt; wrote:
> On Tue, 31 Dec 2013 23:01:00 +0330, Ali Majdzadeh wrote:
> >
> > Jonesy,
> > Of course, but does this make any difference if you force Apache not to
> > process requests for a specified amount of time?
> 
> If you are going to take a web site offline, you should serve up 
> something besides 404's, or "domain unreachable" -- unless it's 
> just a vanity|hobby web site, I suppose.
> 
>  503 Service Unavailable
>     The server is currently unavailable (because it is overloaded 
>     or down for maintenance).[2] Generally, this is a temporary state. 
> 
> Jonesy
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 
>