You mean the address the connection came in on a server with multiple addresses?
You can't. It's not a Node limitation, most (all?) operating systems
don't provide that information. Bind to each address separately.
var Http = require('http');
var Stack = require('stack');
var Creationix = require('creationix');
local handler = Stack(
Creationix.log(),
Creationix.static("/", __dirname, "index.html),
function (req, res, next) {
// custom middleware
// ...
}
);
Http.createServer(handler).listen(80, "65.34.23.44");
Http.createServer(handler).listen(80, "65.34.23.45");
// ...
I just use "stack" and "creationix" here because they don't integrate
tightly with the http.Server instance like Connect and Express do, but
I'm sure the same thing can be done there too.
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to nod...@googlegroups.com
> To unsubscribe from this group, send email to
> nodejs+un...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
No, it's a proxy-ish server that dynamically starts other servers for testing and closes them when the test is finished.
I wanted to tell the client the IP address of the server with the assumption that usually it's the same IP as the proxy, but could be different.
Sent from my Android