Mod_Proxy Connection:Close Workaround?

Mod_Proxy Connection:Close Workaround?

am 08.05.2003 10:21:44 von Amandeep Jawa

Hi folks -

I hope someone can help or at least help me understand what is going
on. I work at Apple and we are using an HTTP based protocol in iTunes
to implement song & database streaming over TCP/IP connections
(http://www.apple.com/itunes/ see the "New Music Sharing feature "
blurb).

Anyway our system presumes a persistent connection ala HTTP 1.1 but
whenever a request is directed through mod_proxy in Apache 1.3.24* a
"Connection: Close" header is added to the request, thus causing the
server to shutdown the connection that is supposed to persist. When
the client makes the next request, it realizes the connection has
closed unexpectedly and assumes the server has been lost.

Can anyone explain what is going on? Why would mod_proxy think it is OK
to add a "Connection: Close" header? Is there anything I can do on the
client to make this NOT happen? I suppose a secondary solution would
be to figure out a server configuration that would disable this - but
I'd rather not go down that path if it can be helped. Any ideas?

'deep



----------------------------------
Amandeep Jawa
Worker Bee Software
----------------------------------
deep@worker-bee.com
225A Dolores St.
San Francisco, CA 94103-2202

Home: 415 255 6257 (ALL MALP)

professional: http://www.worker-bee.com
personal: http://www.deeptrouble.com
political: http://www.sflcv.org

Re: Mod_Proxy Connection:Close Workaround?

am 08.05.2003 10:29:36 von Graham Leggett

Amandeep Jawa wrote:

> I hope someone can help or at least help me understand what is going
> on. I work at Apple and we are using an HTTP based protocol in iTunes
> to implement song & database streaming over TCP/IP connections
> (http://www.apple.com/itunes/ see the "New Music Sharing feature " blurb).
>
> Anyway our system presumes a persistent connection ala HTTP 1.1 but
> whenever a request is directed through mod_proxy in Apache 1.3.24* a
> "Connection: Close" header is added to the request, thus causing the
> server to shutdown the connection that is supposed to persist. When the
> client makes the next request, it realizes the connection has closed
> unexpectedly and assumes the server has been lost.

A connection: close simply tells the client that this server/proxy is
not prepared to support keepalives, which are the default behaviour for
HTTP/1.1, but is not required.

Apache v2.0 supports keepalives in the proxy (the proxy was redesigned
from scratch in v2.0), and will solve your problem.

> Can anyone explain what is going on? Why would mod_proxy think it is OK
> to add a "Connection: Close" header? Is there anything I can do on the
> client to make this NOT happen?

Install Apache v2.0...

Regards,
Graham
--
-----------------------------------------
minfrin@sharp.fm "There's a moon
over Bourbon Street
tonight..."

Re: Mod_Proxy Connection:Close Workaround?

am 08.05.2003 10:38:11 von Jeroen van den Horn

Older versions of Apache exhibit this behaviour - that is Keep-Alive is
not supported (in fact, communication to the backend by mod_proxy is
always HTTP/1.0). You might wanna try the latest 1.3.x or 2.0.x releases
- they should support HTTP/1.1 and keep-alives from the browser to the
proxy (but not from the proxy to the machine your proxying the request to).

Jeroen

Amandeep Jawa wrote:

> Hi folks -
>
> I hope someone can help or at least help me understand what is going
> on. I work at Apple and we are using an HTTP based protocol in iTunes
> to implement song & database streaming over TCP/IP connections
> (http://www.apple.com/itunes/ see the "New Music Sharing feature "
> blurb).
>
> Anyway our system presumes a persistent connection ala HTTP 1.1 but
> whenever a request is directed through mod_proxy in Apache 1.3.24* a
> "Connection: Close" header is added to the request, thus causing the
> server to shutdown the connection that is supposed to persist. When
> the client makes the next request, it realizes the connection has
> closed unexpectedly and assumes the server has been lost.
>
> Can anyone explain what is going on? Why would mod_proxy think it is
> OK to add a "Connection: Close" header? Is there anything I can do on
> the client to make this NOT happen? I suppose a secondary solution
> would be to figure out a server configuration that would disable this
> - but I'd rather not go down that path if it can be helped. Any ideas?
>
> 'deep
>
>
>
> ----------------------------------
> Amandeep Jawa
> Worker Bee Software
> ----------------------------------
> deep@worker-bee.com
> 225A Dolores St.
> San Francisco, CA 94103-2202
>
> Home: 415 255 6257 (ALL MALP)
>
> professional: http://www.worker-bee.com
> personal: http://www.deeptrouble.com
> political: http://www.sflcv.org
>

Re: Mod_Proxy Connection:Close Workaround?

am 08.05.2003 10:59:03 von Graham Leggett

Jeroen van den Horn wrote:

> Older versions of Apache exhibit this behaviour - that is Keep-Alive is
> not supported (in fact, communication to the backend by mod_proxy is
> always HTTP/1.0). You might wanna try the latest 1.3.x or 2.0.x releases
> - they should support HTTP/1.1 and keep-alives from the browser to the
> proxy (but not from the proxy to the machine your proxying the request to).

Just to clarify - Apache v2.0's proxy does support keepalives from the
proxy to the machine you are proxying the request to.

Regards,
Graham
--
-----------------------------------------
minfrin@sharp.fm "There's a moon
over Bourbon Street
tonight..."

Re: Mod_Proxy Connection:Close Workaround?

am 13.05.2003 22:40:38 von Alex Rousskov

On Thu, 8 May 2003, Amandeep Jawa wrote:

> Anyway our system presumes a persistent connection ala HTTP 1.1 but
> whenever a request is directed through mod_proxy in Apache 1.3.24* a
> "Connection: Close" header is added to the request, thus causing the
> server to shutdown the connection that is supposed to persist.
> When the client makes the next request, it realizes the connection
> has closed unexpectedly and assumes the server has been lost.
>
> Can anyone explain what is going on? Why would mod_proxy think it is
> OK to add a "Connection: Close" header? Is there anything I can do
> on the client to make this NOT happen?

In addition to previous answers suggesting using Apache 2.x, please
note that a design relying on or "presuming" persistent connections is
wrong, even with HTTP/1.1. Persistent connections are an optional
optimization feature. Each side (each hop, really) of the HTTP
transaction can close the connection at any time after the transaction
is completed, and there is nothing other agents involved can do about
it. In other words, you cannot force connection persistency.

RFC 2616 contains all the boring details, of course.

If you continue to rely on persistent HTTP connections, you will see
an increase in the number of "broken" environments, as your deployment
grows and more HTTP intermediaries come into play.

HTH,

Alex.

--
| HTTP performance - Web Polygraph benchmark
www.measurement-factory.com | HTTP compliance+ - Co-Advisor test suite
| all of the above - PolyBox appliance