Bug 36411

Summary: ErrorDocument 4xx "text" uses text/html
Product: Apache httpd-2 Reporter: Bj <bjoern>
Component: CoreAssignee: Apache HTTPD Bugs Mailing List <bugs>
Status: RESOLVED WONTFIX    
Severity: normal    
Priority: P2    
Version: 2.0.54   
Target Milestone: ---   
Hardware: Other   
OS: other   

Description Bj 2005-08-30 01:54:41 UTC
.htaccess with sth like

  Redirect 402 /
  ErrorDocument 402 "Payment Required"

For 2.0.54 and 1.3.33 this yields in

  HTTP/1.1 402 Payment Required
  Date: Mon, 29 Aug 2005 23:33:07 GMT
  Content-Type: text/html; charset=iso-8859-1

The Content-Type should be text/plain;charset=<.htaccess encoding> or at least 
the DefaultType. Or failing that this behavior should be documented.
Comment 1 Jeff Trawick 2005-08-30 02:34:43 UTC
For 1.3:

See suppress-error-charset description at
http://httpd.apache.org/docs/1.3/env.html

That will suppress the automatic "charset=iso-8859-1", if you can manage to set
suppress-error-charset for the appropriate set of requests.

Those docs say that it is in Apache >= 2.0.40, but it won't be in Apache 2.0
until 2.0.55.
Comment 2 Bj 2005-08-30 02:48:13 UTC
The main concern is that it uses text/html even though most people probably 
would not use a complete HTML document in ErrorDocument directive. So 
the "redirect" in the suppress-error-charset refers to any "Redirect" redirect? 
Since for the "Redirect 402 /" directive Apache would not generate a redirect 
in HTTP terms. From the documentation I'd call it suppress-redirect-charset.
Comment 3 Joshua Slive 2007-09-21 13:39:57 UTC
I don't see the harm here in using text/html. For any short piece of text it is
going to look the same regardless of the content-type, and this allows you to
use some simple html if you want to.