0

I have a Node.js app which is heavily reliant on websockets. I want to redirect anyone trying to access it via http (80) to https (443). I would use nginx however it does not play well with websockets. No other service needs to run on the server.

What is the best way to do this redirect?

henry.oswald
  • 127
  • 1
  • 8
  • You can do this as described here: https://serverfault.com/questions/67316/in-nginx-how-can-i-rewrite-all-http-requests-to-https-while-maintaining-sub-dom – qknight Jul 15 '17 at 00:12

1 Answers1

1

Many ways to do this but a simple one would be for Nginx to listen only on port 80 (HTTP) and redirect all traffic to 443 (where nodejs is listneing) before any web socket connections are initiated.