15

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.

timmah.faase
  • 2,219
  • 1
  • 15
  • 23
  • 2
    stupid question maybe, but did you enable websocket in IIS? – MrE Jan 15 '16 at 06:39
  • related: http://stackoverflow.com/questions/21838117/reverse-proxy-websocket-iis – MrE Jan 15 '16 at 06:40
  • Websockets is installed, I have not explicitly enabled it in IIS. Instructions here: http://www.iis.net/learn/get-started/whats-new-in-iis-8/iis-80-websocket-protocol-support#TOC301258517 – timmah.faase Jan 17 '16 at 21:09
  • on that same page, under 'issues' it says that if you are using websocket.io in nodejs, you need to disable the iis default websocket. Did you try that? – MrE Jan 17 '16 at 21:30
  • No I don't want to disable it. – timmah.faase Jan 17 '16 at 21:41
  • Well, what I read it say is that node implements it's own websocket and therefore to use with node you should disable the default is websocket. You should at least try to see if it fixes your problem! – MrE Jan 17 '16 at 22:01
  • @MrE, I have changed the setting and results with no success. – timmah.faase Jan 18 '16 at 02:12

1 Answers1

4

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

timmah.faase
  • 2,219
  • 1
  • 15
  • 23