DEV Community

Discussion on: SPAs: Have Your Cache And Eat It Too

Collapse
 
jamesthomson profile image
James Thomson

Hey Andrei, the reason for a fresh index is because it contains the references to your files. E.g. app.ahdj57nl.js, styles.afni47hh.css, etc.

If the index is cached you would end up with references to old files that potentially don’t exist anymore.

Collapse
 
anduser96 profile image
Andrei Gatej

It makes sense now. So to make sure that I understood, the server is who sets the cache headers for other files(*.js, *.css etc). Whereas the meta tags are used to set the headers on the index file.
Did I get it right?

Thread Thread
 
jamesthomson profile image
James Thomson

Correct on the first part, but meta isn’t needed for the index. You set control-headers for the index as well.

Thread Thread
 
anduser96 profile image
Andrei Gatej

Ok. Thanks!