mod_proxy: restore reuse of ProxyRemote connections when possible.#531
Closed
ylavic wants to merge 1 commit intoapache:trunkfrom
Closed
mod_proxy: restore reuse of ProxyRemote connections when possible.#531ylavic wants to merge 1 commit intoapache:trunkfrom
ylavic wants to merge 1 commit intoapache:trunkfrom
Conversation
Fixes a regression from 2.4.59 (r1913907). For a reverse proxy setup with a worker (enablereuse=on) and a forward/CONNECT ProxyRemote to reach it, an open connection/tunnel to/through the remote proxy for the same origin server (and using the same proxy auth) should be reusable. Avoid closing them like r1913534 did. * modules/proxy/proxy_util.c: Rename the struct to remote_connect_info since it's only used for connecting through remote CONNECT proxies. Axe the use_http_connect field, always true. * modules/proxy/proxy_util.c(ap_proxy_connection_reusable): Remote CONNECT (forward) proxy connections can be reused if the auth and origin server infos are the same, so conn->forward != NULL is not a condition to prevent reusability. * modules/proxy/proxy_util.c(ap_proxy_determine_connection): Fix the checks around conn->forward reuse and connection cleanup if that's not possible.
jfclere
approved these changes
May 22, 2025
| return !(conn->close | ||
| || conn->forward | ||
| || worker->s->disablereuse); | ||
| return !(conn->close || worker->s->disablereuse); |
Contributor
There was a problem hiding this comment.
That is the dirty patch I proposed, correct?
Member
Author
There was a problem hiding this comment.
Yes, this allows to reuse remote CONNECT proxy connections eventually, and it's probably enough to recover the performances.
But the code (of mine) in ap_proxy_determine_connection() made no sense too, starting by setting conn->forward = NULL and then checking if it didn't change (while the connection was closed anyway in connection_cleanup()..). Since both the connection and conn->forward are reusable now we'd better change that part too ;)
ylavic
added a commit
to ylavic/httpd
that referenced
this pull request
May 22, 2025
Fixes a regression from 2.4.59 (r1913907). For a reverse proxy setup with a worker (enablereuse=on) and a forward/CONNECT ProxyRemote to reach it, an open connection/tunnel to/through the remote proxy for the same origin server (and using the same proxy auth) should be reusable. Avoid closing them like r1913534 did. * modules/proxy/proxy_util.c: Rename the struct to remote_connect_info since it's only used for connecting through remote CONNECT proxies. Axe the use_http_connect field, always true. * modules/proxy/proxy_util.c(ap_proxy_connection_reusable): Remote CONNECT (forward) proxy connections can be reused if the auth and origin server infos are the same, so conn->forward != NULL is not a condition to prevent reusability. * modules/proxy/proxy_util.c(ap_proxy_determine_connection): Fix the checks around conn->forward reuse and connection cleanup if that's not possible. Submitted by: jfclere, ylavic GH: closes apache#531 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1925743 13f79535-47bb-0310-9956-ffa450edef68
ylavic
added a commit
to ylavic/httpd
that referenced
this pull request
Jun 2, 2025
Fixes a regression from 2.4.59 (r1913907). For a reverse proxy setup with a worker (enablereuse=on) and a forward/CONNECT ProxyRemote to reach it, an open connection/tunnel to/through the remote proxy for the same origin server (and using the same proxy auth) should be reusable. Avoid closing them like r1913534 did. * modules/proxy/proxy_util.c: Rename the struct to remote_connect_info since it's only used for connecting through remote CONNECT proxies. Axe the use_http_connect field, always true. * modules/proxy/proxy_util.c(ap_proxy_connection_reusable): Remote CONNECT (forward) proxy connections can be reused if the auth and origin server infos are the same, so conn->forward != NULL is not a condition to prevent reusability. * modules/proxy/proxy_util.c(ap_proxy_determine_connection): Fix the checks around conn->forward reuse and connection cleanup if that's not possible. Submitted by: jfclere, ylavic GH: closes apache#531 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1925743 13f79535-47bb-0310-9956-ffa450edef68
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes a regression from 2.4.59 (r1913907).
For a reverse proxy setup with a worker (enablereuse=on) and a forward/CONNECT ProxyRemote to reach it, an open connection/tunnel to/through the remote proxy for the same origin server (and using the same proxy auth) should be reusable. Avoid closing them like r1913534 did.
modules/proxy/proxy_util.c:
Rename the struct to remote_connect_info since it's only used for connecting through remote CONNECT proxies. Axe the use_http_connect field, always true.
modules/proxy/proxy_util.c(ap_proxy_connection_reusable):
Remote CONNECT (forward) proxy connections can be reused if the auth and origin server infos are the same, so conn->forward != NULL is not a condition to prevent reusability.
modules/proxy/proxy_util.c(ap_proxy_determine_connection):
Fix the checks around conn->forward reuse and connection cleanup if that's not possible.