File tree Expand file tree Collapse file tree 1 file changed +26
-2
lines changed Expand file tree Collapse file tree 1 file changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -9,10 +9,34 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
99const distPath = join ( __dirname , "../dist" ) ;
1010
1111const server = http . createServer ( ( request , response ) => {
12- return handler ( request , response , {
12+ const handlerOptions = {
1313 public : distPath ,
1414 rewrites : [ { source : "/**" , destination : "/index.html" } ] ,
15- } ) ;
15+ headers : [
16+ {
17+ // Ensure index.html is never cached
18+ source : "index.html" ,
19+ headers : [
20+ {
21+ key : "Cache-Control" ,
22+ value : "no-cache, no-store, max-age=0" ,
23+ } ,
24+ ] ,
25+ } ,
26+ {
27+ // Allow long-term caching for hashed assets
28+ source : "assets/**" ,
29+ headers : [
30+ {
31+ key : "Cache-Control" ,
32+ value : "public, max-age=31536000, immutable" ,
33+ } ,
34+ ] ,
35+ } ,
36+ ] ,
37+ } ;
38+
39+ return handler ( request , response , handlerOptions ) ;
1640} ) ;
1741
1842const port = process . env . PORT || 6274 ;
You can’t perform that action at this time.
0 commit comments