HEAD request with a 404 and custom ErrorPage causes corrupt and mixed-up responses

Solution Unverified - Updated -

Issue

  1. Reverse proxy server(rp-server)
cat << "EOF" >> /etc/httpd/conf/httpd.conf
ProxyRequests Off
ProxyPassMatch   ^(\/.*)$ http://be-server connectiontimeout=10 ping=5 timeout=30
ProxyErrorOverride On
ErrorDocument 404 /404error.html
EOF
  1. Backend server(be-server)
echo "$(hostname -s) 404 error" > /var/www/html/404error.html
echo "$(hostname -s) index"> /var/www/html/index.html

Note: "KeepAlive On(Default)" is needed for the reproducer.

  1. Client
while true; do curl -I http://rp-server/not-exists; sleep 1; done
curl http://rp-server/
  1. Sample mixed-up response
# curl http://rp-server/
be-server 404 errorHTTP/1.1 200 OK
Date: Fri, 03 Feb 2023 06:13:56 GMT
Server: Apache/2.4.6 (Red Hat Enterprise Linux) OpenSSL/1.0.2k-fips mod_fcgid/2.3.9 PHP/5.4.16
Last-Modified: Fri, 03 Feb 2023 06:08:26 GMT
ETag: "b-5f3c58272e7a2"
Accept-Ranges: bytes
Content-Length: 11
Keep-Alive: timeout=5, max=99
Connection: Keep-Alive
Content-Type: text/html; charset=UTF-8

be-server index

Environment

  • Red Hat Enterprise Linux 7
  • httpd

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content