meteorhacks / cluster

Clustering solution for Meteor with load balancing and service discovery
https://meteorhacks.com/cluster-a-different-kind-of-load-balancer-for-meteor.html
MIT License
632 stars 80 forks source link

Does cluster support multitenant (multiple hostname) applications? #99

Closed petermikitsh closed 9 years ago

petermikitsh commented 9 years ago

(I've posted this in Meteor's discussion forums but haven't gotten any replies; my apologies since this space is intended for bug reports).

Has cluster been proven to work on multi-tenant Meteor apps with different subdomains? (e.g., http://tenant-1.mymeteorapp.com, http://tenant-2.mymeteorapp.com, etc). We have two application servers behind a Linode NodeBalancer. We occasionally get 400 and 404 errors.

Error 1 - 400:

WebSocket connection to 'ws://tenant-1.mymeteorapp.com/cluster-ddp/984f584b22cd83724466f92b785072bbe6315b47/petitions/952/tacojr7r/websocket' failed: Error during WebSocket handshake: Unexpected response code: 400

Error 2 - 404:

Failed to load resource: the server responded with a status of 404 (Not Found)
http://tenant-1.mymeteorapp.com/cluster-ddp/984f584b22cd83724466f92b785072bbe6315b47/petitions/977/bc70qgrq/xhr_send

Besides the errors in the console, it has the side effect of some page loads taking awhile (lots of errors being thrown) and some being quick.

Error 3 - Websocket closed before connection is established.

WebSocket connection to 'ws://tenant-1.mymeteorapp.com/cluster-ddp/984f584b22cd83724466f92b785072bbe6315b47/petitions/916/agvlghxv/websocket' failed: WebSocket is closed before the connection is established.
petermikitsh commented 9 years ago

I hope this helps anybody that finds this. Tl,dr: Cluster definitely supports multitenant setups.

Error 1:

We ended up having an issue with a proxy configuration, causing the 404 errors. Changing the proxy configuration got rid of the 404 errors.

Error 2:

400 errors on websocket via HTTP can be caused by some network configurations: http://stackoverflow.com/questions/21344378/intermittent-error-during-websocket-handshake-unexpected-response-code-400-on

Error 3:

This is a reported issue in Firefox. See https://bugzilla.mozilla.org/show_bug.cgi?id=712329 and http://stackoverflow.com/questions/14140414/websocket-interrupted-while-page-is-loading-on-firefox-for-socket-io.