2

I currently have a virtualhost within Apache that is using mod_cband and mod_rewrite. I am using mod_cband to limit the number of connections per remote user. When this limit is exceeded, it is supposed to return 503 Service Unavailable which is the mod_cband default.

If the limit is not exceeded then mod_rewrite should rewrite the URL according to the rules I have specified.

Unfortunately, mod_rewrite seems to take some sort of priority over mod_cband as the rewrite occurs even when the limit is exceeded and 503 Service Unavailable is never returned.

Is there anyway to force mod_cband to be applied before mod_rewrite? Config is as follows:

<VirtualHost *:80>
    ServerName a.domain.com
    ServerAdmin webmaster@domain.com

    CBandRemoteSpeed 1024 1 10

    RewriteEngine on
    # Some other rewrite rules.

    RewriteRule (.*) https://a.domain.com? [R]

    ...

</VirtualHost>
DanielGibbs
  • 573
  • 5
  • 13
  • 32

1 Answers1

3

Move the mod_rewrite processing into a later phase by putting the rules in .htaccess instead.

Ignacio Vazquez-Abrams
  • 45,939
  • 6
  • 79
  • 84