Node.js http request for favicon.ico

AS I was debugging my test node app, I noticed that every http request was sent as actual 2 requests:

– data request (came back with status 200)
– favicon.ico file request (came back with 400, when I hit twitter API)

To get rid of it, simply add an if statement around your http request

if (req.url != '/favicon.ico') {
// send your request
}

Also found a useful snippet in gist on this: https://gist.github.com/763822

Advertisements

One thought on “Node.js http request for favicon.ico

  1. Internet Explorer 7 can be a pain sometimes. So to make sure your fav icon shows in all the curernt browsers. Id suggest using 2 link tags that are exactly the same as the one in your static page example only changing the following rel=’shortcut icon’ (For first tag)rel=’icon’ type=’image/ico’ (For the second tag)Sorry for the 2 comments. Forgot and pasted the code the first time. (Didnt show)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s