Bug 34094 - ErrorDocument for 500 error can't be in Directory Container
Summary: ErrorDocument for 500 error can't be in Directory Container
Status: RESOLVED FIXED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: Documentation (show other bugs)
Version: 2.0.51
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: HTTP Server Documentation List
URL: http://suso.org/
Keywords:
Depends on:
Blocks:
 
Reported: 2005-03-21 04:05 UTC by Suso Banderas
Modified: 2007-07-31 12:19 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Suso Banderas 2005-03-21 04:05:36 UTC
I'm not sure whether this is a mistake in the Apache documents or a bug in the
code, but according the Apache HTTPD document here:

http://httpd.apache.org/docs-2.0/mod/core.html#errordocument

The context for ErrorDocument is listed as "server config, virtual host,
directory, .htaccess"

I have a directory container setup like this:

<Directory />
    ErrorDocument 403 /globalerrors/403.php
    ErrorDocument 404 /globalerrors/404.php
    ErrorDocument 500 /globalerrors/500.php
    Options [masked from this post for security]
    IndexOptions [masked from this post for security]
    AllowOverride [masked from this post for security]
</Directory>

The 403 and 404 error documents work as expected, but when I try to trigger the
500 error document, Apache instead displays the normal Apache stock 500 error
document.   After consulting on this with some folks in the apache IRC channel,
I discovered that moving the ErrorDocument 500 directive outside of the root
directory container and into the main config, the custom 500 error starts to
work.  So I figure that this is either a mistake in the documentation or a bug
in Apache httpd.
Comment 1 John Rowley 2005-04-02 06:43:34 UTC
(In reply to comment #0)
> I'm not sure whether this is a mistake in the Apache documents or a bug in the
> code, but according the Apache HTTPD document here:
> 
> http://httpd.apache.org/docs-2.0/mod/core.html#errordocument
> 
> The context for ErrorDocument is listed as "server config, virtual host,
> directory, .htaccess"
> 
> I have a directory container setup like this:
> 
> <Directory />
>     ErrorDocument 403 /globalerrors/403.php
>     ErrorDocument 404 /globalerrors/404.php
>     ErrorDocument 500 /globalerrors/500.php
>     Options [masked from this post for security]
>     IndexOptions [masked from this post for security]
>     AllowOverride [masked from this post for security]
> </Directory>
> 
> The 403 and 404 error documents work as expected, but when I try to trigger the
> 500 error document, Apache instead displays the normal Apache stock 500 error
> document.   After consulting on this with some folks in the apache IRC channel,
> I discovered that moving the ErrorDocument 500 directive outside of the root
> directory container and into the main config, the custom 500 error starts to
> work.  So I figure that this is either a mistake in the documentation or a bug
> in Apache httpd.

I had exactly this problem with an ErrorDocument for error 414.  Custom error
document would not work in .htaccess or directory container.  (Custom 404 error
documents with exactly the same details would work.) Only solution found to work
was to put entry in main confiuguration as for original error 500 report.
running Server Version: Apache/2.0.52 (Fedora) Server Built: Nov 11 2004 10:31:42
Comment 2 Paul Querna 2005-06-03 00:52:40 UTC
Some errors are generated before the <Directory block or .htaccess files are
read.  Those errors will not be affected by these settings.  I think this is
really a documentation bug.
Comment 3 Joshua Slive 2007-07-31 12:19:22 UTC
ErrorDocument docs now mention that certain errors can't be overridden in
certain circumstances. Not many details, but I think its good enough.