Skip to content

Setting custom time for cache-control for static assets #5069

Closed Answered by kiliman
drishit96 asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, Remix App Server doesn't expose its configuration. You're basically stuck with the defaults and need to eject to your own Express server if you want more flexibility. https://github.com/kiliman/rmx-cli#-eject-ras

Another option is to move your static assets to a folder in app/, like app/assets. Then you can import the asset in your route, and Remix will fingerprint/hash and copy them to public/build/_assets. The build folder sets the cache to immutable so it'll be cached forever. If the asset changes, it'll get a new fingerprint/hash.

https://remix.run/docs/en/v1/guides/migrating-react-router-app#asset-imports

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@drishit96
Comment options

@sergiodxa
Comment options

@kiliman
Comment options

Answer selected by sergiodxa
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants