OSDir


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[users@httpd] enforce 503 response using RewriteRule or Redirect due to temporary maintenance


The configuration directives "RewirteRule" and "Redirect" are having flags to send a FORBIDDEN or GONE response but I need something to send a 503 service_unavailable response to keep away traffic from my proxied backends during maintenance work.

The idea is to use a RewriteMap for this cause I could modify the mapfile to apply maintenance URLs without restarting the httpd server.

EXAMPLE:

$APACHE_HOME/conf/map-offline.conf:
appl1  /errmsg/maintenance
appl2  /errmsg/gone


RewirteMap offline txt:conf/map-offline.conf
RewriteRule ^/([^/]*)(.*)$   ${offline:$1|%{REQUEST_URI}} [NC,PT]

Redirect gone "/errmsg/gone"
Redirect maintenance "/errmsg/maintenance"


Using this setup any request on /appl2/anywhere gets a 410 GONE response - nice
But something like this to get a 503 response is not available.

I only need to add some lines of code into mod_alias to get the maintenance response. No big deal.
But maybe someone here knows a setup working without extending the source code.

Thanks,
Hendrik