0

I want to run my express server on the same port using http & https

for e.g.

http http://example.com:3000

https https://example.com:3000

  • Try setting reverse proxy for that port. Depending on the server you are using to host the code in that port, there are different ways to configure – Ankita Kuchhadiya Dec 26 '19 at 07:30
  • Does this answer your question? [Binding HTTP and HTTPS traffic on the SAME port in node.js?](https://stackoverflow.com/questions/15313308/binding-http-and-https-traffic-on-the-same-port-in-node-js) – Prabhjot Singh Kainth Dec 26 '19 at 07:37
  • There's a reason that http and https default to different ports. You can't have both on the same port. – jfriend00 Dec 26 '19 at 08:06
  • 1
    Does this answer your question? [Nodejs HTTP and HTTPS over same port](https://stackoverflow.com/questions/22453782/nodejs-http-and-https-over-same-port) – rb612 Dec 26 '19 at 09:32

1 Answers1

0

You can use httpolyglot.

https://github.com/mscdex/httpolyglot

It is a module for serving http and https connections over the same port.

Cesar Morillas
  • 707
  • 5
  • 11