Favicon is failing to load for logged-in users

Hi everyone!

After recent updates of my Discourse installation, the favicon started failing to load for all logged in users. Intriguing enough, it does load perfectly when you access the website from a private/incognito browser window, but when you log in with any account, it goes back to failing to load.

I’ve deactivated all plugins to see if that would be the problem, but it with no success. As of right now, my Discourse installation is up-to-date. If you want to go check it out, you can do it so at https://dungeon.gg. Here are some relevant screenshots.

I don’t know if it’s related, but it also seems that some panels from the Admin Dashboard have also stopped loading/working:

How could I go back to serve my website assets with direct links as it used to be before? Maybe that would solve the problem.

If anyone could help me with this, I’d appreciate it. I hope you’re all having great holidays! :christmas_tree:

Simply add the favicon back in using /wizard or in your site settings.

Note that favicon should be a png and obviously a valid png image.

Hi Jeff @codinghorror,

Thanks for reaching out!

I just now did that and re-uploaded the icon, but I’m still getting the same error. The icon is a valid PNG and was working just fine before recent updates from Discourse. I update my installation every week and after the last one, I’ve been facing this issue. :confused:

I went ahead and did some more digging and here’s what I found:

The logo loads perfectly, but favicon does not. And you can see that it’s correctly uploaded. But here’s what’s odd: the timestamp is incorrect. As I said, I just did the wizard again and the favicon timestamp should be as if it were uploaded today. So, I went to the site settings again, reset the favicon and uploaded it again. But here’s what my Rails Console is telling me:

  • output 3: we can see that the reset was successful;
  • output 4: we can see that the new upload was not actually a new one, it just got the old exact same upload.

And again, I don’t think that the upload is the problem, as it was working before.

So I thought: even thought it look odd, it could maybe be an optimisation strategy developed by Discourse? When the same exact asset is uploaded, just use the old one? So I went ahead and re-uploaded a completely different one, getting this:

So, it is an optimisation strategy. But what exactly is going on?

Here are the two logos I’m trying to make it work, both failing though:
dungeon_logo_icon square%4032px

If the image is identical, the checksum will match, and Discourse won’t upload a “copy” of the image. I suggest re-optimizing the image so the checksum doesn’t match.

Just did it:

Same problem. :sob:

@codinghorror, would you like to have any other related info? Logs and such?

Are you changing it using the /wizard ? That’s my recommended course of action. Can you confirm that you changed it through the site setup wizard?

Yes, that’s how I’m changing it. Trying through the /wizard and /admin. :confused:

It looks like you have a bunch of third party plugins active. I think you need to disable all those and rebuild. We have no repro of this here, or on try.discourse.org … and if you are running latest code, the main difference would be plugins.

edit: oh wait, re-reading your first post, you DID try disabling all plugins. My bad.

edit: I can confirm it is logged-on user specific, which is real weird… one thing I don’t quite understand is where the default discourse “sketchy” image would be coming from, if you’ve changed all the site images, that image shouldn’t even exist on your site any more … :thinking:

image

I tried using safe-mode, disabling all plugins, including official ones. Same problem happened. I guess that’s different from rebuilding?

So I just did the rebuild disabling everything. You can take a look at it again if you want. Still, the problem persists. And it’s for logged in users only. :thinking:

We can’t repro it here, though, so I have no idea.

What I find extra mysterious is where is that default grey “sketchy” Discourse image coming from because it shouldn’t exist on your site, as you’ve replaced it already.

  • the current site favicon image seems like a valid PNG
  • I see no other references to the grey “sketchy” default Discourse logo in the F12 source when logged in
  • Nothing looks weird to me in the F12 source w/r/t images
  • Entering “safe mode” doesn’t fix it either

:man_shrugging:

Best guess is, something JavaScript dynamic is interfering, somehow, since it’s also specific to logged in users.

1 Like

Goblins Jeff. Goblins! :eyes:

I’m gonna go ahead and re-enable the plugins again, okay? And I’ll look into that sketchy image.

3 Likes

If you can figure out what the URL path is to that sketchy image, that’d help. I don’t see how that image should be present on your site at all, you’ve replaced it…

Maybe this is one for @tgxworld to look at, though I’m curious why we don’t see it on meta etc.

Hey @codinghorror and @tgxworld,

I think I found something. In my website, the favicon is being proxied and the proxied link returns that sketchy image of Discourse. But the normal link returns the correct favicon.

Proxied link: https://dungeon.gg/favicon/proxied?https%3A%2F%2Fdungeon.gg%2Fuploads%2Fdefault%2Foriginal%2F1X%2Fea21955a8a3d56191e5d88eb8df873de430f6cb5.png
Normal link: https://dungeon.gg/uploads/default/original/1X/ea21955a8a3d56191e5d88eb8df873de430f6cb5.png

1 Like

I don’t know anything about that proxied path, do you @sam?

1 Like

Hey @codinghorror, @tgxworld and @sam!

I think I may have found something.

The proxied favicon instruction is coming from this file. And the actual sketchy Discourse logo is coming from here.

Taking a look at the code, it seems to be adding the /proxied? prefix here:

  @observes("notifyCount")
  faviconChanged() {
    if (Discourse.User.currentProp("dynamic_favicon")) {
      let url = Discourse.SiteSettings.site_favicon_url;
      if (/^http/.test(url)) {
        url = Discourse.getURL("/favicon/proxied?" + encodeURIComponent(url));
      }
      new window.Favcount(url).set(this.get("notifyCount"));
    }
  },

Would you like me to create a pull request fixing this?

1 Like

I really need @sam or someone else to comment on what that proxied stuff is doing, I’m unclear.

1 Like

Favicon proxy is there cause people used to add URLs to favicon that would point off site, this causes significant issues in all sorts of cases, afaik some browser did not like off site favicon.

All of this magic can be nuked now thanks to @tgxworld’s changes as a favicon is guaranteed to be on-site now due to it being a proper upload.

Will assign to @tgxworld to have a look next week and clean this up. No PRs please quite yet.

3 Likes

Ahh nice. OK great. Thanks for pinging us about this and being so persistent in troubleshooting @neemiasvf

1 Like

You’re very welcome @codinghorror. I hope I didn’t bother too much.

Maybe some day I can help you guys code and improve Discourse even more!

1 Like