New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Caching routeInfo.json and react-static-routes.js #516

Closed
arlair opened this Issue Mar 24, 2018 · 2 comments

Comments

Projects
None yet
3 participants
@arlair
Contributor

arlair commented Mar 24, 2018

I noticed in the build routeInfo.json and react-static-routes.js don't have a hash in the file name, so caching them is difficult.

Would hashes on these files be useful to have, or is there some better way to achieve this?

I did find this code in src/client/methods.js

routeInfo.json?${process.env.REACT_STATIC_CACHE_BUST}

but no mention of how to use it. Presumably you set the environment variable REACT_STATIC_CACHE_BUST to a value before you build.

I seem to recall reading before query strings aren't great for caching, eg:

Query strings on the other hand, have been known to cause caching issues. Some proxies or CDNs aren’t even able to cache files that contain query strings and it is recommended not to use them. Additionally, If you run your site through a site speed test, it will likely return a suggestion to remove query strings. Therefore, when using cache busting, try to use file name or file path versioning wherever possible.
https://www.keycdn.com/support/what-is-cache-busting/

@tannerlinsley

This comment has been minimized.

Collaborator

tannerlinsley commented Mar 28, 2018

There are edge cases that limit us from using a hash in the filename for these files. If you would like to investigate and PR a fix, then please do!

@Rusfighter

This comment has been minimized.

Rusfighter commented Aug 26, 2018

There are edge cases that limit us from using a hash in the filename for these files. If you would like to investigate and PR a fix, then please do!

What are the edges cases? Since I think this can improve caching dramatically...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment