Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
This comment has been deleted
Okay, then it’s quite different. You cannot proxy_pass to a Wildcard (*), so you would pass to https://example.com:3000 and then in Node, you would have to implement something, so you know which subdomain is doing the query (look at header Host).
I would recommend keeping Node.js only listening on the localhost and then have Nginx handle the connection between the visitor and Node with the reverse proxy. Then everything runs through Nginx and it’s the one controlling what goes in and out.
And you would then have to setup 3 different server-blocks in Nginx.
One taking care of the http redirect of server_name example.com www.example.com.
One serving the https version of those.
And finally one serving the Wildcard *.example.com on http-only.
Hi @lahuang4
Have you created a DNS record - either A or CNAME for *.example.com ?
Do you have a Wildcard certificate, because it seems like you’re using Let’s Encrypt, which doesn’t support Wildcard, but requires that you generate a certificate for each domain.
And your current http-redirect, it’s only redirecting to domains, but you probably want to redirect all to https, so it should look like this:
server {
listen 80;
listen [::]:80;
server_name .example.com;
return 301 https://$server_name$request_uri;
}
And unless your Node.js is running https and publicly accessible, which means you’ve also setup a certificate in Node.js and it’s accessible directly without Nginx, then your proxy_pass should only look like this:
proxy_pass http://localhost:3000;