I'm using node.js and the http object to connect to a webserver with a special application server. Works fine for an server at amazon, no problems.
No we have a Classic Loadbalancer running. Works - I can enter the URL of the ELB in my browser and I see the answer of our server.
But when I try to open the same URL using my node.js script I always get an timeout.
Sample code:
try {
console.log( "start test" );
var http = require("http");
var options = { host: "test.server.name",
port: "80",
path: "/dp/",
headers: {
'Encoding' : 'BINARY'
}
};
console.log( "start get " + options.host );
http.get( options , function( res ) {
console.log( "in callback" );
res.on('data', function(data) {
console.log( "callback get data " + data );
});
res.on('end', function() {
console.log( "callback end" );
});
res.on('error', function(e) {
console.log( "callback error" );
});
} );
} catch( err ) {
console.log( "error " + err.message );
}
Code works directly with the server. Doesn't work when using the loadbalancer.
And I have to idea what to do - any ideas?