httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ryujiro Shibuya" <rshibuya0...@gmail.com>
Subject RE: Changing Connection header use in forward proxy
Date Fri, 13 Aug 2010 03:13:48 GMT
> -----Original Message-----
> From: "Plüm, Rüdiger, VF-Group" [mailto:ruediger.pluem@vodafone.com]
> Sent: Thursday, August 05, 2010 8:03 PM
> To: dev@httpd.apache.org
> Subject: RE: Changing Connection header use in forward proxy
> 
> 
> 
> > -----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>
> 
> 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");
>              }
>          }
>      }
> 
> Regards
> 
> Rüdiger

Hi Rüdiger,

I've applied this patch on 2.2.16 and tested. As the result, the appropriate
"Connection" header is now sent to the origin server, as expected.
For the usual forward proxy requests, "Connection: close" header is set.
For the forward proxy requests for the origin server individually defined as
"ProxySet keepalive=on", "Connection: Keep-Alive" header is set.

I feel it's a kind of pity that the origin server keep-alive is not fully
provided to general forward proxy requests, but anyway I'm glad that the
"Connection" header becomes consistent to the actual behavior. Thanks!

Regards,
Shibuya




Mime
View raw message