I created the simple Node.js express tutorial and it runs locally. I setup my Azure Web App to pull the repo from BitBucket, which it does, but I'm getting the following error in LogFiles/Application:
Port 80 requires elevated privileges
Why would this be happening? Isn't node running at elevated privileges? If not, how do I configure it so it is?
UPDATE: IMPORTANT!!!
This is never clearly explained in any documentation that I saw...
Azure appears to be doing port forwarding for node.js applications. So when you hit your Azure URL on port 80/443 it gets forwarded to another port that your node.js application is running on. YOU DO NOT SET THAT PORT!! It is an environment variable managed by Azure so you simple listen at process.env.PORT. Done, that's it.
i assume you are using Azure App Service. Even from end-user perspective, request is thru port 80, you will need to update your app to listen on port that get from environment variable, a port which load-balancer will actually distribute request to.
See below tutorial for more details.
https://azure.microsoft.com/en-us/documentation/articles/web-sites-nodejs-develop-deploy-mac/
var http = require('http')
var port = process.env.PORT || 1337;
http.createServer(function(req, res) {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('Hello World\n');
}).listen(port);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With