How to reverse proxy web socket traffic

Discussion in 'General OpenLiteSpeed Discussion' started by Ulrich, May 24, 2018.

  1. Ulrich

    Ulrich New Member

    We have several virtual hosts defined which reverse proxy web traffic to another host. This part is working fine. One of the applications we are running however is also using web sockets to communicate with the browser. Before switching to OpenLiteSpeed we were using Apache as the reverse proxy. Here, all we had to do was:

    ProxyRequests Off
    ProxyPreserveHost On

    ProxyPass / https://backend.domain.com:12345/
    ProxyPassReverse / https://backend.domain.com:12345/

    to proxy all traffic to the backend. This also forwarded the web socket traffic.

    In OpenLiteSpeed we have defined an External App:

    extProcessor hd {
    type proxy
    address https://backend.domain.com:12345
    maxConns 100
    initTimeout 60
    retryTimeout 0
    respBuffer 0
    }

    and used a Rewrite rule in the virtual host definition:

    rewrite {
    enable 1
    RewriteRule ^/(.*)$ https://hd/$1 [P,E=Proxy-Host:hd.domain.com]
    }

    The reverse proxy works fine, but no web socket traffic is being forwarded.

    How do I get the web socket traffic forwarded as well?

    Any help would be greatly appreciated.
     
  2. Tishu

    Tishu Member

  3. Ulrich

    Ulrich New Member

    Tishu,

    thanks. I had already looked at that page and tried to define a web socket proxy with these controls, with not much luck. I get the distinct impression that this is primarily for a web socket server running on the same machine as OLS, which it is not in my case.

    I tried with the following settings:

    URI: /
    Address: x.x.x.x:12345

    where x.x.x.x is the IP address of backend.domain.com

    All this added to the virtual host with the rewrite rule as outlined above.

    It would be nice if the web socket proxy could be directed to use the external app as well...

    Or is there a way to redirect web socket traffic via an additional rewrite rule?
     

Share This Page