File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -254,13 +254,24 @@ app.get([
254254} ) ;
255255
256256app . get ( '*' , ( req , res , next ) => {
257- // Ask browsers to revalidate all files that aren't explicitly cached
257+ // If file didn't explicitly get a cache header added, default to requiring revalidation
258258 if ( res . getHeader ( 'Cache-Control' ) === undefined ) {
259259 res . setHeader ( 'Cache-Control' , 'no-cache' ) ;
260260 }
261261 next ( ) ;
262262} ) ;
263263
264+ app . get ( '*' , ( req , res , next ) => {
265+ // Errors while loading the initial webpack bundles will offer a link that adds ?nocache=random
266+ // and refreshes. We'll tell the browser to actually delete the caches in this case too to increase
267+ // likelihood of success.
268+ if ( req . query . nocache ) {
269+ res . setHeader ( 'Clear-Site-Data' , '"cache"' ) ;
270+ }
271+
272+ next ( ) ;
273+ } ) ;
274+
264275app . get ( '/*' , asyncHandler ( async ( req , res , next ) => {
265276 let pathName = req . path ;
266277 let projectId = null ;
You can’t perform that action at this time.
0 commit comments