HEAD request with a 404 and custom ErrorPage causes corrupt and mixed-up responses
Issue
-
HEAD request with a 404 and custom ErrorPage causes corrupt and mixed-up responses
-
Steps to Reproduce:
- 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
- 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.
- Client
while true; do curl -I http://rp-server/not-exists; sleep 1; done
curl http://rp-server/
- 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.