Bug 60604 - RewriteRule returning 200 for ErrorDocument 503
Summary: RewriteRule returning 200 for ErrorDocument 503
Status: NEEDINFO
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_rewrite (show other bugs)
Version: 2.4.18
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-19 01:24 UTC by Widger
Modified: 2017-03-02 11:23 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Widger 2017-01-19 01:24:43 UTC
I'm trying to setup a custom 503 page for when system maintenance is required.My server is Apache 2.4.18 (Ubuntu). Everything works as expected, except the return code for my error page is 200 instead of 503. I'm using a config that worked on old servers and there's lot of examples on google that have the same issue on my server.

This is within a Vhost and the server is running a few other sites.

Here's the config:
RewriteEngine On

RewriteCond "/maintenance.trigger" -f
RewriteCond %{REQUEST_URI} !=/maintenance.trigger
RewriteRule . - [R=503]


and this is what I get from curl:
HTTP/1.1 200 OK
Date: Thu, 19 Jan 2017 00:53:26 GMT
Server: Apache
Last-Modified: Wed, 18 Jan 2017 22:20:09 GMT
Content-Type: text/html
X-Content-Digest: 8fef50fc2724187fd362f2412e036e2853efa674
Age: 0
X-Rack-Cache: stale, valid, store
Content-Length: 17
Cache-Control: max-age=2592000
Expires: Sat, 18 Feb 2017 00:53:26 GMT

test 503 page


I've tried this a a few different ways and noticed that:
ErrorDocumet 503 "test 503 from config file"

does the right things, unfortunately I would like to have a nicer error page than what can be included in a config file.

I also tried with "ProxyErrorOverride On" but that had no effect.


thank you
Comment 1 Eric Covener 2017-01-19 01:38:23 UTC
Works for me. Maybe it's related to other config / whatever set all of those extra headers in the response (proxy or some application?)
Comment 2 Widger 2017-01-19 03:52:38 UTC
Some more information. Lower down in my configuration I have a RewriteRule that points to a "balancer://". I think this is where the 200 and cache headers are coming from. If I add:

RewriteCond %{REQUEST_URI} !=/maintenance.trigger

before:
RewriteRule . - balancer://mybalancer

I get a 503. I was thinking that hitting a 503 would stop all processing, but it might not work like that.