Azure网站部署监听8080端口的Node.js HTTPS服务器,如何访问?
Hey there! Great question—let me break this down clearly for you.
You don't need to include the :8080 port in your access URL. Just use:https://myapp.azurewebsites.net/
Why is that?
Azure App Service (previously called Azure Websites) acts as a reverse proxy for your app. Here's the breakdown:
- External users send HTTPS requests to Azure on the standard port 443 (or HTTP on 80), which is handled automatically by the platform.
- Azure then forwards those requests internally to the port your Node.js server is listening on—your code uses 8080, which is actually the default internal port that Azure expects for Node.js apps.
- You don't have to expose the internal port to the public; Azure manages the routing between the external standard ports and your app's internal port.
A quick check you can do: If you ever want to confirm the internal port setting, head to your App Service in the Azure Portal, go to Configuration > General settings, and look for the "Port" field—it should be set to 8080 by default, matching your code.
Also, on the HTTPS side: Azure provides a free, managed SSL certificate for your *.azurewebsites.net domain, so using https:// will work out of the box without needing to configure custom certs in your Node.js code (though you can add your own if needed later).
内容的提问来源于stack exchange,提问作者developer7788

