Nodejs http request console.log function prints twice

Whenever I make http requests to a server using node.js, the console.logs inside the http request function output twice. I set up a sever with the following code, and used localhost:8888 on firefox to make a request (localhost:8888):

var http = require('http');
var url = require('url');
function onRequest(request, response) {
    var pathname = url.parse(request.url, true).pathname;
    console.log("Your url pathname is " + pathname);
    response.write("Did you get your response?");
}
var new_server = http.createServer(onRequest).listen(8888);

The console prints:

Your url pathname is /
Your url pathname is /favicon.ico

My questions are:

  1. Why is the request sent twice?
  2. Why is the pathname favicon.ico on the second request despite the fact that I did not specify anything after the socket number in the request url?
  3. Is there any way you can fix these two issues?

Thank you.

Obviously the request isn't sent twice, it's two requests.

It's the browser asking for the favicon. That's a thing browsers do.