What adhesive_cdnKey does and why a cache needs it
Why FiveM resource files are different for every player by default, and how one convar makes them cacheable.
If you have ever put a normal caching proxy in front of a FiveM server, you probably noticed the cache hit rate stayed close to zero. The reason is a convar most server owners never touch: adhesive_cdnKey.
Files are not the same for every player
FiveM protects the files it sends to players. By default every client gets its own key, and the files it downloads are prepared with that key. Two players downloading the same car get two different sets of bytes.
For your server that makes no real difference. For a cache it means every request is unique. There is nothing to reuse, so every download still ends up at your server.
What the convar changes
set adhesive_cdnKey "your-long-random-key"Setting adhesive_cdnKey tells the server to use one fixed key for everyone. The file a player in Germany downloads is now exactly the same as the file a player in Brazil downloads. A cache can store it once and serve it to all of them.
Use a long random string as the key. Treat it like a password, so keep it out of public Discord channels and screenshots of your server.cfg.
Does this make my assets less protected?
It moves where the protection happens. With a shared key the files are the same for everyone, so what matters is who is allowed to download them.
FiveMCDN only serves files to players who are connected to your server at that moment. Every download request carries a session token from the FiveM client. We check it with your server before serving anything, and it stops working a few minutes after the player leaves. Someone who only knows a file URL gets nothing. You can also lock your own server's file endpoint so it only answers the CDN. The docs cover both.
Changing the key later
A new key changes the bytes of every file. Players download everything again on their next join, and the cache refills from your server. So pick a key once and leave it alone, unless you think it has leaked.
In short
- Without adhesive_cdnKey, a cache in front of FiveM cannot reuse anything.
- With it, one download from your server can serve all your players.
- FiveMCDN generates a key for you and puts it in the config block on your dashboard. See how fileserver_add works for the other half of the setup.