1

I have a RESTful server in go, and it's behind nginx. everything is fine and we are happy with this setup (nginx and go) but now we have a websocket route for this application. (Its currently works ok with nginx in our staging server, not real load yet.) The questions :

  1. Is this good for my websocket route to be behind nginx too? is there any good reason for/against this?

  2. Is there any way to bypass this route from nginx proxy and serve it directly with go? not in another subdomain or another binary.

Thanks!

fzerorubigd
  • 1,664
  • 2
  • 16
  • 23

1 Answers1

1

I am no nginx expert but given that nobody else has answered I will present some of my research.

1) Yes, nginx is definitely a good choice for that. You can find some benchmarks here. Possible caveats are mentioned in this (older) post. The most important point to consider is the timeout aspect. These two answers give helpful information in that regard.

2) Not exactly sure what you want to achieve by that but you could simply use a different port, as websockets are not subject to the same origin policy, or use the tcp forwarding module that is described in one of the answers above.

Stephan Dollberg
  • 32,985
  • 16
  • 81
  • 107