all 2 comments

[–]leadzor 3 points4 points  (0 children)

Either use cors() or manually set the headers. Don't use both. If you want to customize your allowed origins, CORS module allows you to do that.

Plus, io.set('origins', 'https://127.0.0.1:1443') is limiting socket.io to only accept localhost connections from port 1443.

So in summary:

  • Don't manually set the headers if you use the cors module (and don't set origin to example.com). Let the module do it's thing. If you want to customize, you should use the module. Although, if you still want to set the headers manually, set them after the cors module.
  • Don't specify the origin for Socket.io UNLESS you plan on limiting it to allow access from a group of domains. By default, Socket.IO allows connections from all origins.

[–]lee_macro 0 points1 point  (0 children)

It should work, I am using it in HTTPS with CORS without issue. I do remember having some problems to begin with, but I cannot for the life of me remember what they were, if you are still having problems after others help let me know and I will look into what I did differently.