double requests from Chrome

7,220 views
Skip to first unread message

Mark Volkmann

unread,
Feb 5, 2012, 5:43:25 PM2/5/12
to nod...@googlegroups.com
Here's a very simple HTTP server:

var http = require('http');

http.createServer(function (req, res) {
  console.log('got a request');
  res.writeHead(200);
  res.end('Hello, World!');
}).listen(3002);

When I hit this from Chrome, "got a request" is output twice and two more times every time I refresh the page in the browser.
However, when I do this from Firefox I only see "got a request" once for each refresh.
Does anyone know why Chrome is sending duplicate requests and what I can do to avoid this?

--
R. Mark Volkmann
Object Computing, Inc.

Chris Rhoden

unread,
Feb 5, 2012, 5:47:55 PM2/5/12
to nod...@googlegroups.com

It is attempting to download favicon.ico

chrisrhoden, from my telephone.

--
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

Ben Noordhuis

unread,
Feb 5, 2012, 5:49:34 PM2/5/12
to nod...@googlegroups.com

It's a bug in Chrome where it keeps trying to download /favicon.ico

http://code.google.com/p/chromium/issues/detail?id=39402

Ryan Doenges

unread,
Feb 5, 2012, 6:47:45 PM2/5/12
to nod...@googlegroups.com
yep, it's GETting /favicon.ico.

this has gotten me before, it is really irritating.

> --
> 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
>


--
Ryan Doenges

Matt

unread,
Feb 5, 2012, 6:56:06 PM2/5/12
to nod...@googlegroups.com
Another thing chrome does - if you have an iframe with src="#" (rather than src="") which you're going to display/hide later, Chrome will request the page twice.

Isaac Schlueter

unread,
Feb 5, 2012, 7:17:11 PM2/5/12
to nod...@googlegroups.com
I personally think this behavior is fine. Just serve a /favicon.ico
or a fast 404 when requested. HEAD should always be safe and
idempotent.

Christopher Jeffrey

unread,
Feb 5, 2012, 7:27:07 PM2/5/12
to nodejs
> Another thing chrome does...

This isn't just chrome. Every browser since the 90s automatically
requests /favicon.ico.

Will Wen Gunn

unread,
Feb 5, 2012, 7:28:42 PM2/5/12
to nod...@googlegroups.com
Every Browser will automatically requests /favicon.ico file.

2012/2/6 Christopher Jeffrey <chjje...@gmail.com>
> Another thing chrome does...

This isn't just chrome. Every browser since the 90s automatically
requests /favicon.ico.

Isaac Schlueter

unread,
Feb 5, 2012, 7:28:54 PM2/5/12
to nod...@googlegroups.com
The thing that chrome does differently is request *again* if the
server responds with a non-favicon or non-200 response.

Christopher Jeffrey

unread,
Feb 5, 2012, 7:40:47 PM2/5/12
to nodejs
Will Wen Gunn wrote:
> Every Browser will automatically requests /favicon.ico file.

I agree. Did I say something different?

Isaac Schlueter wrote:
> The thing that chrome does differently is request *again* if the
server responds with a non-favicon or non-200 response.

Ah, I see now.
Reply all
Reply to author
Forward
0 new messages