I am using Nginx to point a subdomain to a different port that a node.js server is listening to.
It works fine for http, but now I need to switch over to https.
This is what I have right now in sites-available/default
:
server {
listen 80;
listen 443;
server_name sub.example.com;
location / {
proxy_pass http://example.com:2222;
}
}
Now that I am switching my node server over to https do I need to change the proxy_pass
to https://example.com:2222
?
Now that I am switching my node server over to https do I need to change the proxy_pass to https://example.com:2222?
Short answer is no. It doesn't need to be same protocol for proxy as for incoming request But you may require another directive
proxy_set_header X-Forwarded-Proto https;
I found this in my searches.
Turns out it's best to handle the SSL certification with nginx and leave node running a http server.