Almost all the http APIs return a 502 bad gateway error after adding a CDN

Solution 1:

proxy_pass httpS://127.0.0.1:3000... Are you sure that you can connect to the localhost (127.0.0.1) via SSL?

proxy_set_header X-Forwarded-Proto $scheme; - in this line, you already forward the scheme to the upstream server. So, the application (or the upstream server) should be smart enough to identify the scheme being used / forwarded.

So, the proxy_pass directive should be proxy_pass http://127.0.0.1:3000.