IIS Reverse proxy and websockets, failed websocket handshake

5,250

It seems that WebSocket support was not available in IIS 7.5.

http://www.iis.net/learn/get-started/whats-new-in-iis-8/iis-80-websocket-protocol-support

Share:
5,250

Related videos on Youtube

Egidi
Author by

Egidi

Updated on September 18, 2022

Comments

  • Egidi
    Egidi almost 2 years

    I am running a little website using IIS 7.5 on Windows Server 2008 R2. I've got a node.js application too running on port 3000.

    Http calls from the website (client browser) are reverse proxied from http://example.com/node/whatever to http://localhost:3000/whatever. Everything works fine so far.

    The problem is when i try to use socket.io.

    I am receiving:

    WebSocket connection to 'ws://example.com/socket.io/?EIO=3&transport=websocket&sid=adb9WRpoMFYRoS0vAAAB' failed: Error during WebSocket handshake: Unexpected response code: 502 
    

    I am pretty sure, if i am not wrong, that:

    It does forward the initial request to my server as the initial request to a websocket server is a standard HTTP request (with some additional headers). IIS does know about that and simply forwards the request. However, upon receiving the websocket request the websocket server sends a 101 response and switch into websocket mode. IIS does not understand the websocket traffic and it is not able to proxy that.

    Is there a trick or solution to configure the reverse proxy for the ws:// adresses?

  • Egidi
    Egidi over 9 years
    that was just what I feared, isn't there any workaround on IIS 7.5?