Open SamuelGaona opened 7 years ago
+1
I agree that you need do this in webserver (nginx/apache)
A example in nginx:
server {
listen 80;
server_name my.domain.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
server_name my.domain.com;
[....]
}
Some of us might not want to have an apache or nginx in front of our node app. How can this be done using spdy directly?
Some of us might not want to have an apache or nginx in front of our node app. How can this be done using spdy directly?
Add a second server listener using the "normal" node http (1.1) package on port 80, which returns a 301
with https://youraddress
for every request.
@n1try sounds good, thanks :)
That is a way to do it, but it might not be the solution you are looking for since it will stop you from using spdy/h2 benefits, i.e: you won't be able to do push streams.
This module API maps to Node.js http module, the example here https://github.com/spdy-http2/node-spdy#examples should be the answer you are looking for, have you tried it so far?
How do I get to work this?