You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Hendrik Harms <he...@gmail.com> on 2018/06/22 10:22:16 UTC

[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

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

Posted by Yann Ylavic <yl...@gmail.com>.
On Fri, Jun 22, 2018 at 12:22 PM, Hendrik Harms <he...@gmail.com> wrote:
>
> Redirect maintenance "/errmsg/maintenance"

I don't think "maintenance" is a valid keyword (it may be interpreted
as an expression), what about:
   Redirect 503 "/errmsg/maintenance"
?

Regards,
Yann.

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