[Solved] Access via IIS reverse proxy died after upgrade to 0.58

Finally found a solution. It appears IIS ARR does not handle websocket compression properly (see here). You can work your way around this by clearing the Sec-WebSocket-Extensions header on the incomming requests:

  1. First add the server variable to IIS manager: Your site > URL Rewrite > View Server Variables… > Add: HTTP_SEC_WEBSOCKET_EXTENSIONS

  2. Then add the variable to the inbound rule that forwards requests to Home Assistant. This is my rule in web.config:

    <rule name="Forward to Home Assistant" stopProcessing="true">
        <match url="(.*)" />
        <action type="Rewrite" url="http://localhost:8123/{R:0}" logRewrittenUrl="true" />
        <serverVariables>
            <set name="HTTP_SEC_WEBSOCKET_EXTENSIONS" value="" />
        </serverVariables>
    </rule>
    

    You can also add the variable to the inbound rule with IIS-Manager, but it forces you to enter a value. You still end up with editing web.config to clear the value.

This became an issue in 0.58 because aiohttp added support for compression extensions for websockets. This compression made the IIS ARR issue visible. It was the aiohttp 2.3.0 changelog that put me in the right direction.

I’m now running 0.59.2 without any issues :slight_smile:

5 Likes