Skip to content

Commit 3b090d0

Browse files
authored
Merge pull request modelcontextprotocol#367 from cliffhall/cache-bust-inspector-client
Fix the inspector caching problem
2 parents cfe82c8 + 59cc89d commit 3b090d0

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

client/bin/client.js

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,34 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
99
const distPath = join(__dirname, "../dist");
1010

1111
const 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

1842
const port = process.env.PORT || 6274;

0 commit comments

Comments
 (0)