You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Oscar Cassetti <os...@gmail.com> on 2010/12/20 18:12:08 UTC

[users@httpd] Issue with mod_proxy ProxyPass balancer and web sockets

Hello,

I believe I have found an issue in Apache/2.2 mod_proxy when using
balancers and  ProxyPass balancer in conjunction with web Sockets.
The issue is that mod_proxy seems not to pass  the following headers
Connection
Upgrade


When a client sends a ws handshake request as the following

GET /WTEST/jms HTTP/1.1\r\n
Sec-WebSocket-Key1: 1 5 416  H4J50 60\r\n
Connection: Upgrade\r\n
Upgrade: WebSocket\r\n
Origin: http://localhost\r\n
Sec-WebSocket-Key2: 48 91 083 N0  Z5\r\n
Host: localhost\r\n
\r\n


mod_proxy passes to one of  members balancer the following

GET /WTEST/jms HTTP/1.1\r\n
Host: localhost\r\n
Sec-WebSocket-Key1: 1 5 416  H4J50 60\r\n
Origin: http://localhost\r\n
Sec-WebSocket-Key2: 48 91 083 N0  Z5\r\n
X-Forwarded-For: 127.0.0.1\r\n
X-Forwarded-Host: localhost\r\n
X-Forwarded-Server: 127.0.1.1\r\n
Connection: Keep-Alive\r\n
\r\n


The missing headers are fundamentals for the Web Sockets protocol handshake.

I wonder if it is possible to configure mod_proxy to pass the missing
headers. My current configuration is as follow

ProxyRequests       Off
ProxyPreserveHost   On

<Proxy *>
  Order deny,allow
  Allow from all
</Proxy>

<Proxy balancer://gf>
    BalancerMember http://localhost:8080
</Proxy>


<VirtualHost *:80>
<Location />
    ProxyPass balancer://gf/ lbmethod=byrequests
</Location>
</VirtualHost>


Please let me know if you need  more details on this as I captured the
traffic between client-> Apache -> balancer using wireshark

I also wonder if there is any on going work to make mod_proxy web sockets aware.

Thank you

--
Oscar Cassetti

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Issue with mod_proxy ProxyPass balancer and web sockets

Posted by Tom Evans <te...@googlemail.com>.
On Tue, Dec 21, 2010 at 2:17 PM, Oscar Cassetti
<os...@gmail.com> wrote:
> Do you think that would be too hard to extend mod_proxy_http in order
> to support them?
> Or would it be more sensible to look at some other module or
> application that support websocktes?
>

Wikipedia says* this about websockets and proxies:

"""
Some proxy servers are harmless and work fine with WebSocket; others
will prevent WebSocket from working correctly, causing the connection
to fail. In some cases additional proxy server configuration may be
required, and certain proxy servers may need to be upgraded to support
WebSocket.
If unencrypted WebSocket traffic flows through an explicit or a
transparent proxy server on its way to the WebSocket server, then,
whether or not the proxy server behaves as it should, the connection
is almost certainly bound to fail today
"""

Websockets are not HTTP, they only handshake over HTTP, so I doubt
mod_proxy_http would be able to support these bi-directional, long
living sockets. Probably would require a new proxy module.

Cheers

Tom

* ok, so not an authoritative source

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Issue with mod_proxy ProxyPass balancer and web sockets

Posted by Oscar Cassetti <os...@gmail.com>.
Do you think that would be too hard to extend mod_proxy_http in order
to support them?
Or would it be more sensible to look at some other module or
application that support websocktes?

--
Oscar Cassetti

On Mon, Dec 20, 2010 at 5:49 PM, Eric Covener <co...@gmail.com> wrote:
>> The issue is that mod_proxy seems not to pass  the following headers
>> Connection
>> Upgrade
>
> You're using mod_proxy_http, and the HTTP RFC says these are
> hop-by-hop headers.  There doesn't appear to be a way to short-circuit
> this, so you'd probably need proxy protocol module that knew about the
> websocket protocol [or something that worked at a lower layer that
> wouldn't care about the HTTP layer]
>
> --
> Eric Covener
> covener@gmail.com
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Issue with mod_proxy ProxyPass balancer and web sockets

Posted by Eric Covener <co...@gmail.com>.
> The issue is that mod_proxy seems not to pass  the following headers
> Connection
> Upgrade

You're using mod_proxy_http, and the HTTP RFC says these are
hop-by-hop headers.  There doesn't appear to be a way to short-circuit
this, so you'd probably need proxy protocol module that knew about the
websocket protocol [or something that worked at a lower layer that
wouldn't care about the HTTP layer]

-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org