Bug 49699 - Inconsistent Keep-alive from proxy to the origin server.
Summary: Inconsistent Keep-alive from proxy to the origin server.
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_proxy_http (show other bugs)
Version: 2.2-HEAD
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
Keywords: MassUpdate
Depends on:
Reported: 2010-08-03 23:00 UTC by Ryujiro Shibuya
Modified: 2018-11-07 21:08 UTC (History)
0 users

Captured packets (can be opened by tcpdump, Wireshark, etc.) (28.44 KB, application/octet-stream)
2010-08-03 23:00 UTC, Ryujiro Shibuya

Note You need to log in before you can comment on or make changes to this bug.
Description Ryujiro Shibuya 2010-08-03 23:00:57 UTC
Created attachment 25836 [details]
Captured packets (can be opened by tcpdump, Wireshark, etc.)

If the (forward-)proxy receives "Connection: Keep-alive" request from client, it sends "Connection: Keep-alive" to the origin server as well. But the proxy closes the connection to the origin server immediately after it receives the response (or after it sends response to the client).
[Initially found on 2.2.11 and confirmed with 2.2.16]

The possible negative impact of the symptom:
The origin server would expect the upcoming HTTP request in the persistent connection. So the sudden close of connection may cause a confusion on the origin server.

If the Keep-alive to the origin server is disabled ("SetEnv proxy-nokeepalive" in httpd.conf), then there is no chance that the proxy confuses the origin server with "Connection: Keep-alive".
However, I don't know how can we enable Keep-alive (without immediate closing the connection) to the origin server.

How to reproduce:
1. Turn on forward proxy feature with the following httpd.conf, and run httpd.
ProxyRequests On
<Proxy *>
Allow from all

2. Run tcpdump (or anything equivalent) to monitor the packets.
# tcpdump -i any -s 0 -w 0.cap tcp port 80

3. Use telnet to send a request:
$ telnet localhost 80
GET http://httpd.apache.org:80/ HTTP/1.1
Host: httpd.apache.org:80
Connection: Keep-Alive
Comment 1 Ryujiro Shibuya 2010-08-03 23:28:28 UTC
The connection seems closed indirectly through apr_pool_clear(), in the ap_proxy_release_connection() of proxy_util.c
1665        if (conn->close_on_recycle || conn->close || worker->disablereuse ||
1666            !worker->is_address_reusable) {
1667            apr_pool_t *p = conn->pool;
1668            apr_pool_clear(p);

At the line 1665, according to the debugger,
  conn->close_on_recycle == 0,
  conn->close == 0,
  worker->disablereuse == 0,
  worker->is_address_reusable == 0.

I wonder why 'is_address_reusable' is set to 0, since I have not configured anything special to prohibit the reuse of the opened connection.
Comment 2 William A. Rowe Jr. 2018-11-07 21:08:51 UTC
Please help us to refine our list of open and current defects; this is a mass update of old and inactive Bugzilla reports which reflect user error, already resolved defects, and still-existing defects in httpd.

As repeatedly announced, the Apache HTTP Server Project has discontinued all development and patch review of the 2.2.x series of releases. The final release 2.2.34 was published in July 2017, and no further evaluation of bug reports or security risks will be considered or published for 2.2.x releases. All reports older than 2.4.x have been updated to status RESOLVED/LATER; no further action is expected unless the report still applies to a current version of httpd.

If your report represented a question or confusion about how to use an httpd feature, an unexpected server behavior, problems building or installing httpd, or working with an external component (a third party module, browser etc.) we ask you to start by bringing your question to the User Support and Discussion mailing list, see [https://httpd.apache.org/lists.html#http-users] for details. Include a link to this Bugzilla report for completeness with your question.

If your report was clearly a defect in httpd or a feature request, we ask that you retest using a modern httpd release (2.4.33 or later) released in the past year. If it can be reproduced, please reopen this bug and change the Version field above to the httpd version you have reconfirmed with.

Your help in identifying defects or enhancements still applicable to the current httpd server software release is greatly appreciated.