You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2015/03/24 16:12:33 UTC

[Bug 57751] New: Problems with proxy reverse to websockets

https://bz.apache.org/bugzilla/show_bug.cgi?id=57751

            Bug ID: 57751
           Summary: Problems with proxy reverse to websockets
           Product: Apache httpd-2
           Version: 2.4.12
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: mod_proxy_wstunnel
          Assignee: bugs@httpd.apache.org
          Reporter: albegarcia@gmail.com

I've been working on an architecture composed of an Apache and a set of Tomcat
clusters for several years without any problems. Apache acts as a reverse proxy
to the Tomcat clusters by using mod_proxy and mod_proxy_http and everything has
been working fine. 

However, my problems have started when I've included websockets in the
applications running in the Tomcat environment. Now, my configuration is
similar to this (using mod_proxy, mod_proxy_http and mod_proxy_wstunnel, among
other modules):

---------------------------------
-- Begin configuration snippet --
---------------------------------

<Proxy balancer://clusterAPP1Websocket>
        BalancerMember wss://localhost:8443/app1/messaging route=1
        BalancerMember wss://localhost:9443/app1/messaging route=2
        ProxySet stickysession=ROUTEID
</Proxy>

<Proxy balancer://clusterAPP1>
        BalancerMember https://localhost:8443/app1 route=1
        BalancerMember https://localhost:9443/app1 route=2
        ProxySet stickysession=ROUTEID
</Proxy>

<Proxy balancer://clusterAPP2Websocket>
        BalancerMember wss://localhost:10443/app2/messaging route=1
        BalancerMember wss://localhost:11443/app2/messaging route=2
        ProxySet stickysession=ROUTEID
</Proxy>

<Proxy balancer://clusterAPP2>
        BalancerMember https://localhost:10443/app2 route=1
        BalancerMember https://localhost:11443/app2 route=2
        ProxySet stickysession=ROUTEID
</Proxy>

ProxyPass /app1/messaging balancer://clusterAPP1Websocket
ProxyPass /app1 balancer://clusterAPP1
ProxyPassReverse /app1/messaging balancer://clusterAPP1Websocket
ProxyPassReverse /app1 balancer://clusterAPP1

ProxyPass /app2/messaging balancer://clusterAPP2Websocket
ProxyPass /app2 balancer://clusterAPP2
ProxyPassReverse /app2/messaging balancer://clusterAPP2Websocket
ProxyPassReverse /app2 balancer://clusterAPP2

---------------------------------
-- End configuration snippet --
---------------------------------

The thing is that when I open an URL like https://localhost/app1/messaging/info
(I'm using the SockJS client and the first step is to open a connection to this
URL) and right after I open an URL like https://localhost/app2/something (with
the same browser instance), the reverse proxy send the request to the APP1
cluster (balancer://clusterAPP1) instead of to the APP2 cluster. Therefore, I
get an HTTP 404 return code from the Tomcat running in the APP1 cluster. It's
like the first opened connection using for the first request is reused to send
the second one.

One tip: if after opening https://localhost/app1/messaging/info I wait for a
while (around 30 seconds), the connection to the server is closed (I don't know
if the connection is closed by the browser or by Apache) and the following
request to https://localhost/app2/something is correctly routed to the second
cluster.

I hope I have explained the problem clearly.

Thanks in advance and best regards.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 57751] Problems with proxy reverse to websockets

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=57751

--- Comment #3 from Jim Jagielski <ji...@apache.org> ---
Can you confirm this is still an issue w/ the latest version (2.4.23)?

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 57751] Problems with proxy reverse to websockets

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=57751

--- Comment #2 from Alberto García <al...@gmail.com> ---
Created attachment 32605
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=32605&action=edit
Error log in debug level

This is an error log with LogLevel established to debug.

As you can see, the URLs and the ports in the log file are not the same as in
the description of the bug. This is because I tried to simplify my
configuration.

The steps I've done to get this log are the following:

1. Start the server
2. Request to https://localhost/rni/ssooMessaging/info
3. Request to https://cvtfssoo.operaciones.adif.es/cas/login (with the same
browser instance)
4. Stop the server

Thanks.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 57751] Problems with proxy reverse to websockets

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=57751

Eric Covener <co...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO

--- Comment #1 from Eric Covener <co...@gmail.com> ---
Can you share some trace?

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 57751] Problems with proxy reverse to websockets

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=57751

Alberto García <al...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEEDINFO                    |RESOLVED

--- Comment #4 from Alberto García <al...@gmail.com> ---
It works fine with the last version (2.4.23). However, I had to do some changes
in my configuration:

---------------------------------
-- Begin configuration snippet --
---------------------------------

<Proxy balancer://clusterAPP1Websocket>
        BalancerMember wss://localhost:8443/app1/messaging route=1
        BalancerMember wss://localhost:9443/app1/messaging route=2
        ProxySet stickysession=ROUTEID
</Proxy>

<Proxy balancer://clusterAPP1>
        BalancerMember https://localhost:8443/app1 route=1
        BalancerMember https://localhost:9443/app1 route=2
        ProxySet stickysession=ROUTEID
</Proxy>

<Proxy balancer://clusterAPP2Websocket>
        BalancerMember wss://localhost:10443/app2/messaging route=1
        BalancerMember wss://localhost:11443/app2/messaging route=2
        ProxySet stickysession=ROUTEID
</Proxy>

<Proxy balancer://clusterAPP2>
        BalancerMember https://localhost:10443/app2 route=1
        BalancerMember https://localhost:11443/app2 route=2
        ProxySet stickysession=ROUTEID
</Proxy>

ProxyPassMatch "/app1/messaging/(.*)/websocket"
balancer://clusterAPP1Websocket/$1/websocket
ProxyPass /app1 balancer://clusterAPP1
ProxyPassReverse /app1/messaging balancer://clusterAPP1Websocket
ProxyPassReverse /app1 balancer://clusterAPP1

ProxyPass "/app2/messaging/(.*)/websocket"
balancer://clusterAPP2Websocket/$1/websocket
ProxyPass /app2 balancer://clusterAPP2
ProxyPassReverse /app2/messaging balancer://clusterAPP2Websocket
ProxyPassReverse /app2 balancer://clusterAPP2

---------------------------------
-- End configuration snippet --
---------------------------------

The change was due to the fact that the request to /app1/messaging/info was
done without sending the websockets headers (Upgrade: WebSocket, Connection:
Upgrade). For this reason, there wasn't a valid handler for this request in the
clusterAPP1Websocket. With the new configuration, request to
/app1/messaging/info are handled by clusterAPP1 (by using mod_proxy_http) and
the rest of the request relative to websockets (in the form of
"app1/messaging/997/5vkkyptu/websocket", I'm using Java + Spring + SockJS) are
handled by clusterAPP1Websocket (by using mod_proxy_wstunnel) in the correct
way.

Thanks a lot.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org