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 /
    ProxyPassReverse /

    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
    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,]

    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


    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

    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?
  4. lsqtwrk

    lsqtwrk New Member


    Do you mean , proxy WS traffic without invoking websocket tab configuration ?
  5. Ulrich

    Ulrich New Member


    if that's possible, sure. As I mention in the original post, the Apache setup we had in place was pretty straightforward in that it proxied any and all traffic.

    I can see that OLS has the separation as a feature, but in my case I would simply like to forward everything to the backend - I don't need to separate regular and WS traffic.
  6. lsqtwrk

    lsqtwrk New Member

    Hi, Unfornately that proxy is only for http and https , for websocket , is must use websocket tab to set backend for websocket :)

    Best regards,

Share This Page