[NUI] NUI Not Reading Discord Image URLs?

Hey,
So I’m trying to display an image on the players screen and it was working fine until I noticed the other day it seems to just not work anymore, no code changes were made. The image is a Discord URL and upon looking into it, it seems that any Discord image URL simply, does not work in this application (html img tag). I have tried other random image URL’s and they work no problem. Not too sure what changed?

Tested on game version 2699 & 2619

Discord is not an image hosting service, which is why after a certain period of time, images are “unloaded” from the cache (or something similar). I recommend using dedicated platforms, such as “imgbb” or many others.

Yeah, I’m not using it for long term image hosting, just quite literally brand new images from discord are not displaying either. Not like they’d even get the chance to time out

Discord blocks requests to their CDN when the referer field in the header contains cfx-(Request made from within CEF contain this header value)

Some recent code commits replace this header value with something more ‘generic’ when sending requests to affected Discord URLs, so changing your client version to unstable should do the trick.

Ref.: fix(nui): better fix for discordapp URLs · citizenfx/fivem@9b180de · GitHub

1 Like

You’re the best, man!