Hide Forgot
### Description of problem: A customer would like to use this Apache httpd server like a sorry server but they do not want to put any contents on the server. So, they use RedirectMatch for most requests to send a redirection. Also they want to configure to send a redirection to specific URL for 413 "Request Entity Too Large", which is different from the URL specified with RedirectMatch. But setting ErrorDocument 413 to a remote URL does not work for the requests are marked as redirect. ### Version-Release number of selected component (if applicable): httpd-2.2.15-54.el6_8.x86_64 ### How reproducible: Anytime. ### Steps to Reproduce: 1. Configure LimitRequestBody, ErrorDocument for 413 and RedirectMatch: LimitRequestBody 100 ErrorDocument 413 http://www.example.com/error413.html <Location /> RedirectMatch temp ^(?!/server-status$) http://www.example.com/index.html </Location> 2. Prepare a test file which is larger than LimitRequestBody: dd if=/dev/zero of=/tmp/testfile bs=1 count=101 3. Sent a POST request with the generated file: curl -X POST -vs -T /tmp/testfile http://127.0.0.1/index.html ### Actual results: An original error page is shown and the message "error was encountered while trying to use an ErrorDocument to handle the request" is shown inside the error page. ~~~ < HTTP/1.1 413 Request Entity Too Large < Date: Thu, 15 Sep 2016 01:36:53 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>413 Request Entity Too Large</title> </head><body> <h1>Request Entity Too Large</h1> The requested resource<br />/hoge<br /> does not allow request data with POST requests, or the amount of data provided in the request exceeds the capacity limit. <p>Additionally, a 413 Request Entity Too Large error was encountered while trying to use an ErrorDocument to handle the request.</p> </body></html> ~~~ ### Expected results: Redirected to the specified remote URL. ### Additional info: Same issue is reproducible with RHEL 7 Apache httpd 2.4.6 and also the latest community version (2.4.23). ### Possible Workaround: Specify a literal string (a simple error message) to ErrorDocument. (For example: ErrorDocument 413 "413 Request Entity Too Large" ) But this is generally not what the customer want. Or put a html page which performs a redirection in the client side, then use RewriteRule to handle requests with the html page like the following. "ErrorDocument 413 <remote-url>" works with this configuration: * redirect.html: ~~~ <head> <meta http-equiv="refresh" content="0; URL=http://example.com/"> <script type="text/javascript"> location.replace("http://example.com") </script> <title>Redirect</title> </head> ~~~ * mod_rewrite setting: ~~~ RewriteEngine On RewriteCond %{REQUEST_URI} !^/server-status$ RewriteRule ^/(.*) /redirect.html ~~~
Just want to point out (on this old ticket) that I am experiencing the same issue with the latest version of Apache (2.4.25) as well. The workaround that Miura has outlined is not optimal so a solution would be best. I'm checking upstream for the solution at the moment (since this is probably not a RH-specific problem), and will report back if a solution is available.
Red Hat Enterprise Linux 6 transitioned to the Production 3 Phase on May 10, 2017. During the Production 3 Phase, Critical impact Security Advisories (RHSAs) and selected Urgent Priority Bug Fix Advisories (RHBAs) may be released as they become available. The official life cycle policy can be reviewed here: http://redhat.com/rhel/lifecycle This issue does not appear to meet the inclusion criteria for the Production Phase 3 and will be marked as CLOSED/WONTFIX. If this remains a critical requirement, please contact Red Hat Customer Support to request a re-evaluation of the issue, citing a clear business justification. Red Hat Customer Support can be contacted via the Red Hat Customer Portal at the following URL: https://access.redhat.com