You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2018/01/08 16:59:10 UTC

[Bug 61975] New: Error page reports an ErrorDocument problem when a RewriteRule has set the status code

https://bz.apache.org/bugzilla/show_bug.cgi?id=61975

            Bug ID: 61975
           Summary: Error page reports an ErrorDocument problem when a
                    RewriteRule has set the status code
           Product: Apache httpd-2
           Version: 2.4.27
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core
          Assignee: bugs@httpd.apache.org
          Reporter: apache-bugzilla@michael-kaufmann.ch
  Target Milestone: ---

When a RewriteRule has set the status code, the generated error page may
contain the phrase "Additionally, a 301 Moved Permanently error was encountered
while trying to use an ErrorDocument to handle the request." But there is no
ErrorDocument problem. A RewriteRule has changed the status code to 301.


Configuration:

# redirect HTTP to HTTPS
RewriteRule ^/(.*)$ https://www.example.com/$1 [R=301,L]


Request (it has two Content-Length headers, so httpd generates an error page):

curl -v --data "a=b" -H "Content-Length: 1" -H "Content-Length: 10"
"http://www.example.com/"


Response:

< HTTP/1.1 400 Bad Request
< Date: Mon, 08 Jan 2018 16:38:52 GMT
< Server: Apache
< Connection: close
< Content-Type: text/html; charset=iso-8859-1
< 
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
</p>
<p>Additionally, a 301 Moved Permanently
error was encountered while trying to use an ErrorDocument to handle the
request.</p>
</body></html>

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 61975] Error page reports an ErrorDocument problem when a RewriteRule has set the status code

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61975

--- Comment #2 from Marc Stern <ma...@approach.be> ---
(In reply to Marc Stern from comment #1)
My example is for a reverse proxy where the server sends a 400 status

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 61975] Error page reports an ErrorDocument problem when a RewriteRule has set the status code

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61975

--- Comment #1 from Marc Stern <ma...@approach.be> ---
I have the same behaviour in another case, with mod_security2.

Example:
  # Used to hide server response body (more complex rule in real)
  SecRule RESPONSE_STATUS 400 "phase:3,status:400"
  ErrorDocument 400 /my_error_page.html
Output:
  Bad Request
  Your browser sent a request that this server could not understand.
  Additionally, a 400 Bad Request error was encountered while trying
  to use an ErrorDocument to handle the request.

This is really a major ennoyance.
I don't see any work-around.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org