Node.js And Azure: Is it a Port or a Pipe?

When deploying a node.js application to a azure website, the node.js environment variable process.env.port is set. One would think that port, is a the listening port and write something like this:

var port = process.env.port | 8080;

The problem? In azure website, port is not an int, it is a string. More problematic, it is not a port at all. It is a pipe. It looks something like this:


The good news, node.js can handle this. Be careful though, many modules for node.js are not expecting this to be the case and me have to be set up and initialized differently than the standard IP/Port examples. Hapi and Express for example can and have  run on azure.

Tags: ,

One Response to “Node.js And Azure: Is it a Port or a Pipe?”

  1. Randy Says:

    Thanks for your post. Unfortunately, I’m having a very similar issue and I’m hoping you can help me. I’m not running azure, but I AM running on a server under IIS using IISNode. I built a simple little chat program that works fine locally. I get the same type of pipe for the port number. If I launch a command prompt and hardcode the port # in the .js file like so (httpServer.listen(3000, function ()…) and launch the browser on port 3000, i can send message back and forth to chat windows. However, if I use the process.env.PORT, it listens on the pipe string and I can launch my application, however they dont send message between the two chat windows. I’m wondering why this would be? I know the code is good since if I hardcode 3000, it works fine. Any ideas?

    Also I noticed someone was suggesting a url rewrite rule? I’m not particularly knowledgable on that but I’m wondering if that some how can play into a solution?

Leave a Reply