File tree 1 file changed +26
-2
lines changed 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));
9
9
const distPath = join ( __dirname , "../dist" ) ;
10
10
11
11
const server = http . createServer ( ( request , response ) => {
12
- return handler ( request , response , {
12
+ const handlerOptions = {
13
13
public : distPath ,
14
14
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 ) ;
16
40
} ) ;
17
41
18
42
const port = process . env . PORT || 6274 ;
You can’t perform that action at this time.
0 commit comments