fivem icon indicating copy to clipboard operation
fivem copied to clipboard

files endpoint does not expose HTTP cache validation headers, causing stale CDN cache

Open the-big-gs opened this issue 7 months ago • 2 comments

What happened?

When /files is cached behind a CDN or caching proxy, updated resource files can remain stale because the endpoint does not expose standard HTTP cache validation headers.

At the moment, /files appears to return 200 OK with basic response headers, but without ETag, Last-Modified, Cache-Control, or If-None-Match handling.

This makes cache revalidation unreliable and can require manual purging after file updates.

Expected result

/files should expose standard HTTP cache validation headers so caching proxies/CDNs can revalidate file changes correctly instead of continuing to serve stale content.

Reproduction steps

  1. Put the /files endpoint behind a caching proxy or CDN
  2. Cache a file served from /files
  3. Update that file on the server
  4. Request it again through the proxy/CDN

Observed result: stale content may continue to be served unless the cache is manually purged.

Importancy

Unknown

Area(s)

FXServer

Specific version(s)

FXServer latest (tested on Windows/Linux)

Additional information

From the current code:

  • FilesHttpHandler.cpp already reads hash data through ResourceFilesComponent::GetFileHashPairs()
  • /files responses currently write content-length, transfer-encoding, and 200 OK
  • I could not find ETag, Cache-Control, or If-None-Match handling in this path

A minimal improvement would be to expose HTTP cache validation for /files, for example by reusing the existing hash information for an ETag and supporting conditional requests.

the-big-gs avatar Apr 11 '26 08:04 the-big-gs

Is there anyone who can review this ?

the-big-gs avatar Apr 20 '26 11:04 the-big-gs

I'm taking a look at this and currently working on a fix.

KAZRUTx avatar May 17 '26 11:05 KAZRUTx