Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Joseph Bertino
seal-mask
.a{fill-rule:evenodd;}techdegree
Joseph Bertino
Full Stack JavaScript Techdegree Student 14,652 Points

Why is Firefox adding "favicon.ico" to my GET request?

When contacting localhost:3000 in Firefox, I get the success message "I Love Treehouse" returned by my Express server, but I see that in addition to the request GET http://localhost:3000 sent by my browser, a second request GET http://localhost:3000/favicon.ico is also sent, and the Express server returns a 404 response for this request. Why is this extra request being sent?

Here's my app.js

const express = require('express');

const app = express();

app.get('/', (request, response) => {
    response.send("I Love Treehouse!");
});

app.listen(3000);

1 Answer

Hi Joseph,

So a favicon is a little image that sits on the tab. For treehouse it's a little green shape, with a negative shape created from the outline of a frogs hand/leg(???).

In any case, they are so common that most browsers automatically ask the server for it when a get request is sent. But if your server doesn't have one, then it sends the browser a 404 (not found) response for that request.

It's not caused by an issue with your code, and there isn't a way to keep it from happening (as far as I know). I guess if you don't want to add a favicon to your server, you could write a route that accounts for that automatic request from the browser and send back a different response.

In any case, that's what's going on.