Why does node.js, http-server, show that there are two request coming? -


i have following simple http-server setup using node.js:

var http = require('http'); var port = 12311  http.createserver(function (req, res) {      console.log("incomming request " + req.connection.remoteaddress);      res.writehead(200, { 'content-type': 'text/plain' });     res.end("test string");   }).listen(port); console.log("listening on " +  port); 

as can see, when request comes in, log console. when browse localhost:12311 console shows 2 connections have come in:

"e:\program files\nodejs\node.exe" hello-world-server.js listening on 12311 incomming request 127.0.0.1 incomming request 127.0.0.1 

why this?

it's request favicon.ico. if don't have one, it's requested norm defines default file path if don't set relevant <link rel="shortcut icon"... in header.

the best ways find requests :

  • client side, opening developer tools , looking @ network tab.
  • server side, logging req.url

Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -