spdy-http2 / node-spdy

SPDY server on Node.js
2.81k stars 196 forks source link

Listen http and https to the same port #261

Closed buzinas closed 8 years ago

buzinas commented 8 years ago

I found some examples over the internet, but none of them are simple, nor they can handle redirecting - for example - http://localhost:3000/ to https://localhost:3000/

I found one to redirect the default ports 80 to 443, but those ones don't apply for the app I'm building, unfortunately. And I don't want to have any reverse proxy webserver in front of Node.js also.

So, being direct: is there any simple way to redirect all the http requests to https?

indutny commented 8 years ago

Sorry, but I don't think that this mode is going to be supported in node-spdy.

You may want to give a try to HSTS.

codepunkt commented 7 years ago

@indutny since http2 package does not work with express, spdy is my best bet to serve an express app over http2. I can not have another webserver such as nginx or apache in front of the express app, but i want both http and https being served, with http being redirected to https.

HSTS does not help here. If the user types in the url of the app on his first visit (e.g. http://myspdyapp.com), he doesn't get a response and therefore doesn't get the HSTS header that will tell his browser to visit the site on https for subsequent visits - which is not acceptable in my use case.