Easy way to make sure updated builds overwrite browser cache

Sometimes I’ll do a build of something and upload the dist to our FTP server, then clients say the build hasn’t updated due to their browser cache. I remember at an old job our web devs did something like give the updated webpage a unique id or something that meant the browsers like chrome would always clear their cache for the latest. Is this something you guys have encountered?

Original Post on Discord

by user 103054507105067008

Oh interesting - i didnt know you could do that to be honest

I am running into the same issue, but one of the options in the answer here may help.

by user 943936853348855838

@ROBYER1 I think what your team was doing was “Cache Busting”. I wonder if the exporter could append ?v# to the files, or using the hash approach mentioned in the article below. This could force the content to always load fresh.

Thoughts?

by user 943936853348855838

Ah it would be added to the asset file names? (e.g my-scene.54534.glb)

yeah, according to the article hash is the best approach as it is unique to the actual file(s).

by user 943936853348855838

So probably, save, hash, rename with hash.

by user 943936853348855838

One thing that immediately comes to mind is e.g. how about a glb referencing another glb. It would need to serialize with that hash included already I think and I’m not sure I like that “just” for killing the cache :thinking:

For now I am testing the html and .htaccess header approaches and will let you know how that goes.

by user 943936853348855838

I can see how that would become convoluted.

by user 943936853348855838

I think it can just be appended as query parameter @marcel :cactus: , doesn’t need to be actually part of the file name - same how Glitch handles uploading assets (when you copy the URL of an uploaded asset it always has ?v=somenumber appended)

Could be super handy to have as an option when exporting/building to make sure it force updates the cache on server

by user 103054507105067008

I look into it tomorrow :slightly_smiling_face:

Added a hash to loading glbs for the next version generated on export
unknown.png

added in the latest update