remix icon indicating copy to clipboard operation
remix copied to clipboard

Remix doesn't use browser cached versions of route JS/manifest

Open waynerobinson opened this issue 1 year ago • 1 comments

What version of Remix are you using?

1.7.2

Steps to Reproduce

Production version deployed of any application with correctly configured CDN permanently caching assets.

Chrome version 105.0.5195.125 if relevant.

Expected Behavior

Requests to any assets that have been previously retrieved by the browser should hit the browser cache first.

Actual Behavior

Assets retrieved in the root of the application hit the browser cache first but other routes will always be requested from the CDN.

If you look at the below screenshot you'll see that all the top-level assets are returned from memory/disk cache but the $interactionld-6GDCZIFD.js and manifest-888341CD.js files hit the CDN and get a 304 even though these are available locally (hence the 304).

Network Requests Waterfall Example

waynerobinson avatar Oct 11 '22 23:10 waynerobinson

@waynerobinson What are the other response headers on those two files? (Especially cache-control) I assume this is using the built in remix server? (We have no issues with this when using Express with custom caching behaviour)

app.use("/build", express.static("public/build", { immutable: true, maxAge: "1y" }));

wub avatar Oct 25 '22 22:10 wub