A transparent 16x16 favicon.ico file is always returned, regardless of site logos

Hi,

The favicon doesn’t show up in my browser (Chrome 46.0.2490.80 m) on this forum when I’m logged in:

It does show up if I log out, then disappears when I log in again.

Any idea?

I just tried on your site and I could see the favicon both times (logged out and logged in).

That’s weird.

I can actually reproduce the problem on Firefox as well:

Chrome:

Maybe I somehow disabled the favicon for my user? Is that even possible?

Maybe it works only on certain screen densities. At least that’s my conclusion after reading http://realfavicongenerator.net/faq

The Favicon check for meta doesn’t look good either.

BTW: My Chrome on Android doesn’t show the favicon on the start screen. It’s just a yellow “D”. The favicon for Github works.

Can’t repro on IE:

But the problem persists in Chrome and Firefox even when the browser cache is disabled.

@gerhard Unrelated. I’m doing all my tests on the same PC, and the favicon shows properly in IE (always) and in Chrome/Firefox when not logged in.

Oh, sorry, I overlooked the part with (not) logged in. :blush:
Could it be that clearing the cache doesn’t remove cached Favicons? That still doesn’t explain why you see a different behaviour when you are logged in… Anyway, try with a new browser profile.
If it still doesn’t work, try using a network sniffer or at least the browser’s debugging tools to figure out what’s going on.

BTW: I noticed that the server’s certificate chain is incomplete. You should probably fix that.

1 Like

@gerhard No problem.

I opened a Guest window in Chrome (so, technically, a different user profile I suppose) and the problem persists when I log in with my usual Discourse user. In the same browser window, I created a new user in Discourse, then logged in: the favicon showed up. Then I logged off again (the favicon was still there), and I logged in with my usual user, and again the favicon disappeared. Very strange.

Regarding the certificate chain being incomplete: I’m not exactly sure what I need to do, I guess I forgot to upload a certificate file on the server, thus it gets downloaded every time?

You need to concat your certificate and the intermediate certificate(s) otherwise your site works only in browsers that have the missing intermediate certificate in it’s cache.

cat "Your Certificate" "Intermediate CA Certificate" "Intermediate CA Certificate" >> ssl.crt
1 Like

@gerhard Thanks, I’ll try to fix that.

Regarding the favicon problem, I’m not sure why Chrome doesn’t download it, even in incognito mode with caching disabled (even though the favicon shows up since I’m not logged in):

Seems like https://meta.discourse.org/favicon.ico is returning something, but should not be.

@codinghorror Right, and that may occasionally confuse browsers? Should it special-case and return a 404 error?

Something new: This morning I’m seeing this (notice the pinkish square as favicon):

Sorry, it seems this is mostly a support issue for the specific site in question. Other than the Android issue @gerhard pointed out, there’s nothing to fix in Discourse proper. The favicon.ico is mostly for ancient browsers and we’re about to drop support for IE9 on Jan 1 2016.

If necessary, we can redirect the requests for that file to the .png assets we must carry for modern browser icons, etc.

Jeff, related or not, I think you’ve hinted at something. In my case, https://forum.appleseedhq.net/favicon.ico does return a fully transparent 16x16 icon. Could this be the problem?

Actually you’re right, I did not understand that we are returning a valid blank ico file here, which is … not good. @sam will change it so that nginx returns the 404 for that file, before it even hits the rails stack.

Long story but there are still a lot of requests for that file from old browsers and old crawlers and view-source and so forth.

Changed per:

https://github.com/discourse/discourse/commit/81bdd2328da34ec48ae6f31ea1e20bd2a45f679a

The blank favicon was a hack I placed in the code base even before we had our Docker deployment story (we were noticing a lot of load on our custom 404 page which is not free to generate), now that we deploy using docker and NGINX is part of the stack we can send out cheap 404s using NGINX.

4 Likes

I just updated my instance, /favicon.ico does return a 404 error now, but the problem persist, only when I log in with my user. For all other users, the favicon shows up correctly.

I actually noticed that, when I’m logged in with my usual user, the favicon does show up briefly before disappearing. It gets replaced, or removed, after the page has completed loading.

Maybe that has to do with the fact that my user is an administrator, and thus more things get rendered or happen than for normal users?

Also, the favicon shows up correctly if I disable JavaScript.

Wild guess: Maybe it’s the counter shown on the browser icon that’s causing this.
Try disabling “Show new / updated topic count on browser icon” in the user’s preferences if it’s enabled. Does that help?

5 Likes