Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Proxying Meteor WebSockets through IIS ARR

We have a need to proxy Meteor through an IIS proxy. An IIS site accepts bindings for a particular Meteor website and proxies the requests through to an alternate port.

Web sockets are not working and Meteor is reverting to XHR.

Web.Config file as follows:

<rule name="Meteor reverse proxy" stopProcessing="true">
    <match url="(.*)" />
    <conditions>
        <add input="{CACHE_URL}" pattern="^(.+)://" />
    </conditions>
    <action type="Rewrite" url="{C:1}://127.0.0.1:8008/{R:1}" />
</rule>

By accessing the website via 127.0.0.1:8008 on the server it works fine. Accessing the website through the IIS proxy fails.

I have noticed IIS ARR is changing the casing of the headers, removing a header (sec-websocket-extensions) and adding a handful of extras. This might not be related.

IIS Proxy:

Failed Headers

Direct:

Working Headers

MS documentation recommends disabling WebSockets when in use alongside NodeJS. Updating this setting does not help. http://www.iis.net/learn/get-started/whats-new-in-iis-8/iis-80-websocket-protocol-support#TOC301258519

Has anyone come across this issue?

Update You'll notice the header above references ARR2.5, this version does not support web sockets. 3.0 is required to proxy sockets.

like image 336
timmah.faase Avatar asked Dec 21 '15 05:12

timmah.faase


1 Answers

After testing the proxy via an alternative web socket hello world, ARR was proxying web sockets successfully. To solve the issue we disabled compression on web sockets within Meteor.

SERVER_WEBSOCKET_COMPRESSION environment variable to 0

https://forums.meteor.com/t/websocket-compression-introduced-in-meteor-1-2-doesnt-work-with-passenger-docker-nginx/12025

like image 169
timmah.faase Avatar answered Oct 21 '22 20:10

timmah.faase