简体   繁体   中英

SSL port for Azure Web Site using node.js?

I'm having difficulty getting a node.js app deployed as an Azure Web Site to listen on the appropriate port for SSL (within the Azure environment).

Serving up SSL requests in any other environment where I have control over the port is no problem and working fine. I don't believe this to be an issue with the app code (using Express, FYI).

Azure Web Sites seem to forward port 80 traffic from the load balancer to whatever port is available, which is set in the process.env.PORT variable.

I don't see any relevant equivalent within process.env for SSL traffic, despite having successfully loaded a cert into the Azure portal for the given Web Site and configured its bindings.

My question is this: how can I configure Azure to spit out the requisite file descriptor for traffic on port 443?

I've read a little on how to configure a worker in a Cloud Service here , but it doesn't seem applicable for a Web Site.

For reference, when I attempt to listen on either 443 or process.env.PORT , I get the following error:

Application has thrown an uncaught exception and is terminated:
Error: listen EACCES
    at errnoException (net.js:901:11)
    at Server._listen2 (net.js:1039:14)
    at listen (net.js:1061:10)
    at Server.listen (net.js:1127:5)

I assume you've read http://www.windowsazure.com/en-us/develop/net/common-tasks/enable-ssl/

If I understand it correctly, Azure will do the https termination for you. Your app/service still gets http traffic.

Regardless, you still need to listen on process.env.PORT . Always. And will always get http traffic there (not https). If the original client used port 80, Azure will just do a pass-thru to you. If the client used 443, Azure will terminate the https and open an http request to you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM