-3

I've nodejs application which port number is 3001 and this app working with http but not work with https. On apache server, set the revers proxy for 80 or 443 to 5001 and set revers proxy for 3001 also.

http://<domain>:3001/socket.io/socket.js   ---> Work

https://<domain>:3001/socket.io/socket.js   ---> Not Work(Secure Connection Failed or This site can’t be reached)

Here I need to know same port(3001) is work with http and https ?

Any solution for that?

rgg
  • 45
  • 1
  • 1
  • 6

1 Answers1

3

The HTTP protocol does allow for STARTTLS - see RFC 2817 which allows a client to connect over the clear text HTTP protocol and then upgrade the existing TCP connection to TLS.

So in theory you can run both HTTP and support "HTTPS" on the same port, except that as far as I know nobody actually uses that. But support for RFC 2817 is present on Apache httpd via the SSLEngine optional Directive.

Using a HTTPS URI mandates setting up the TLS connection before initiating the HTTP protocol which does not combine with STARTTLS so that is a no-go.

HBruijn
  • 72,524
  • 21
  • 127
  • 192
  • So in other words, a system where an `https://` URL points to a server which runs HTTP (not HTTPS) by default will not work, and vice versa, although on the protocol level this could be supported by some other scheme. – tripleee Dec 14 '16 at 11:31
  • I think not, I think it would give a protocol mismatch error – HBruijn Dec 14 '16 at 15:01