1

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?

1

2 Answers 2

0

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; 
Sign up to request clarification or add additional context in comments.

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.