httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ewald Dieterich <>
Subject Reverse proxy: invalid Content-Length leads to 413 + 400 errors mixed up
Date Thu, 08 Jan 2015 09:38:56 GMT
I set up a simple reverse proxy with Apache 2.4.10 on Debian unstable:

ProxyPass / http://backend/
ProxyPassreverse / http://backend/

When I send a request to the reverse proxy with an invalid 
Content-Length header, I get two 413 and 400 response bodies concatenated:

$ curl -i -H "Content-Length: a" http://frontend/
HTTP/1.1 413 Request Entity Too Large
Date: Thu, 08 Jan 2015 09:00:33 GMT
Server: Apache/2.4.10 (Debian)
Connection: close
Content-Type: text/html; charset=iso-8859-1

<title>413 Request Entity Too Large</title>
<h1>Request Entity Too Large</h1>
The requested resource<br />/<br />
does not allow request data with GET requests, or the amount of data 
provided in
the request exceeds the capacity limit.
<address>Apache/2.4.10 (Debian) Server at frontend Port 80</address>
<title>400 Bad Request</title>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
<address>Apache/2.4.10 (Debian) Server at frontend Port 80</address>

Even though the HTTP status code in the response is 413, the access log 
shows a 400 error:

[...] "GET / HTTP/1.1" 400 904 "-" "curl/7.26.0"

I think that first a 413 error is created that later gets replaced 
partly by a 400 error.

Here are some log entries:

[...] AH01587: Invalid Content-Length

=> That's where a 413 (HTTP_REQUEST_ENTITY_TOO_LARGE) is created.

[...] (-102)Unknown error -102: [client] AH01095: 
prefetch request body failed to (frontend) from ()

=> That's were where a 400 (HTTP_BAD_REQUEST) is returned.

Any ideas how to fix this so that this situation is handled as a single 
error and not as two errors mixed up?

View raw message