Commit cfe82de
fix(runtime): serve /discovery with Cache-Control: no-store (cloud#152)
The discovery payload reflects MUTABLE runtime config — notably `routes.mcp`,
which is only advertised when OS_MCP_SERVER_ENABLED=true. getDiscoveryInfo()
(and isMcpEnabled(), which reads process.env fresh) recompute it correctly on
every request, but the two discovery routes (`/.well-known/objectstack` and
`${prefix}/discovery`) emitted no Cache-Control header, so an edge/CDN could
cache the response. After MCP was enabled on a staging env, GET /discovery kept
returning `routes.mcp: undefined` (stale, even with cache-busting query params),
so the objectui Integrations page rendered "MCP not enabled" against a live MCP
server.
Mark both discovery routes `Cache-Control: no-store` so the payload is never
cached — config changes (enable MCP, add a plugin/service) are reflected
immediately. +regression test asserting the header on both routes.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent a2a5a08 commit cfe82de
2 files changed
Lines changed: 36 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
| 18 | + | |
18 | 19 | | |
| 20 | + | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
| 24 | + | |
22 | 25 | | |
23 | 26 | | |
24 | 27 | | |
| |||
72 | 75 | | |
73 | 76 | | |
74 | 77 | | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
75 | 99 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
452 | 452 | | |
453 | 453 | | |
454 | 454 | | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
455 | 463 | | |
456 | 464 | | |
457 | 465 | | |
| |||
462 | 470 | | |
463 | 471 | | |
464 | 472 | | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
465 | 476 | | |
466 | 477 | | |
467 | 478 | | |
| |||
0 commit comments