On 05.08.2010 13:03, "Plüm, Rüdiger, VF-Group" wrote:
-----Original Message-----
From: Rainer Jung
Sent: Donnerstag, 5. August 2010 11:51
To: dev@httpd.apache.org
Subject: Changing Connection header use in forward proxy
It seems the forward proxy by default sets "Connection: Keep-Alive"
although it later closes the connection when it detects
is_address_reusable == 1 in the worker.
Doesn't it make sense to issue "Connection close" instead?
Since this happens in the code where we have a connection and
a request,
but no worker struct available, is it safe to apply this whenever
proxyreq is PROXYREQ_PROXY? Or can one somehow configure a
non-default
forward worker with an explicit URL to e.g. a frequently used origin
server which would then be expected to reuse connections? I
don't expect
that to be posible, but I'm not sure.
I haven't tried so far, but IMHO it should be possible to setup
pooled connections for frequently used targets of a forward proxy
by adding
<Proxy http://www.frequentlyused.com/>
# Set an arbitrary parameter to trigger the creation of a worker
ProxySet keepalive=on
</Proxy>
Actually after staring at the code for a while IMHO there is no
difference between a forward or a reverse worker. There's only a default
forward and a default reverse worker and then additional workers as
configured.
It does make a difference whether a request is handled in forward or
reverse mode, but that is independent of workers.
You can define a worker originally meant for reverse use like in
ProxyPass /something http://www.origin.com
and allow forward mode
ProxyRequests On
If you then send
GET http://www.origin.com/ HTTP/1.0
your request will be handled by the worker defined through the above
ProxyPass (including pooling etc.). So "forward worker" or "reverse
worker" only makes sense for those builtin default workers (which are
kind of fallback and not configurable).
If I am correct with this assumption the we should not proceed the way
you proposed.
How about the following untested patch instead?
Index: modules/proxy/proxy_util.c
===================================================================
--- modules/proxy/proxy_util.c (revision 982130)
+++ modules/proxy/proxy_util.c (working copy)
@@ -1568,6 +1568,7 @@
*balancer = NULL;
*worker = conf->forward;
access_status = OK;
+ apr_table_set(r->subprocess_env, "proxy-nokeepalive", "1");
}
}
else if (r->proxyreq == PROXYREQ_REVERSE) {
@@ -1578,6 +1579,7 @@
*balancer = NULL;
*worker = conf->reverse;
access_status = OK;
+ apr_table_set(r->subprocess_env, "proxy-nokeepalive", "1");
}
}
}
Thanks, looks good, will test.
Regards,
Rainer