user3126804
user3126804

Reputation: 129

How to make a delay between Http request and Response on Apache server

I have a method of request processing of web traffic. I use Modsecurity module on my apache server and i process the log of alerts of Modsecurity each time, and i want server to make a delay when it wants to response to any request when i am processing that logs of request.

I mean,i need an instruction to configure my apache server in order to make a specific delay to response to a request.

Upvotes: 4

Views: 4102

Answers (2)

PentagramPro
PentagramPro

Reputation: 116

As far as I can see, there is no built-in way of making delay in apache. However there is some nice workaround. You can use filtering to busy your server with work and to make it respond slower.

There is mod_ext_filter module which takes server output/input and runs it through external application. If you read documentation on this module, you'll find following example (add this to your httpd.conf):

# mod_ext_filter directive to define a filter
# which runs everything through cat; cat doesn't
# modify anything; it just introduces extra pathlength
# and consumes more resources
ExtFilterDefine slowdown mode=output cmd=/bin/cat \
    preservescontentlength


# core directive to cause the slowdown filter to
# be run several times on output
#
SetOutputFilter slowdown;slowdown;slowdown;slowdown;slowdown;slowdown;slowdown;slowdown;slowdown;slowdown;slowdown;slowdown;slowdown;slowdown;slowdown;slowdown;slowdown;slowdown;slowdown;slowdown;slowdown;slowdown;slowdown;slowdown;slowdown

What it does it just says mod_ext_filter to run cat many times on server output. It makes my server pretty slow. Don't forget to check that apache loads the mod_ext_filter (httpd.conf):

LoadModule ext_filter_module modules/mod_ext_filter.so

Upvotes: 2

pavan
pavan

Reputation: 34

Use filters to make the delay. If urs is jsp based one,use servlet concept filters, Try to slow the control inside dofilter() method

Upvotes: 0

Related Questions