fluxy-bot 0.5.21 → 0.5.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/supervisor/index.ts +5 -1
- package/worker/index.ts +9 -0
package/package.json
CHANGED
package/supervisor/index.ts
CHANGED
|
@@ -716,11 +716,15 @@ export async function startSupervisor() {
|
|
|
716
716
|
}
|
|
717
717
|
|
|
718
718
|
// Poll until the full chain is actually working (avoid 502s)
|
|
719
|
+
// Cache-busting query param prevents browsers/CDN from serving stale 502s
|
|
719
720
|
const probeUrl = config.relay?.url || tunnelUrl;
|
|
720
721
|
let ready = false;
|
|
721
722
|
for (let i = 0; i < 20; i++) {
|
|
722
723
|
try {
|
|
723
|
-
const res = await fetch(probeUrl +
|
|
724
|
+
const res = await fetch(probeUrl + `/api/health?_cb=${Date.now()}`, {
|
|
725
|
+
signal: AbortSignal.timeout(3000),
|
|
726
|
+
headers: { 'Cache-Control': 'no-cache' },
|
|
727
|
+
});
|
|
724
728
|
if (res.ok) { ready = true; break; }
|
|
725
729
|
} catch {}
|
|
726
730
|
await new Promise(r => setTimeout(r, 1000));
|
package/worker/index.ts
CHANGED
|
@@ -63,6 +63,15 @@ initWebPush();
|
|
|
63
63
|
const app = express();
|
|
64
64
|
app.use(express.json({ limit: '10mb' }));
|
|
65
65
|
|
|
66
|
+
// Prevent browsers/CDN/relay from caching API responses (avoids stale 502s)
|
|
67
|
+
app.use('/api', (_, res, next) => {
|
|
68
|
+
res.set('Cache-Control', 'no-store, no-cache, must-revalidate, proxy-revalidate');
|
|
69
|
+
res.set('Pragma', 'no-cache');
|
|
70
|
+
res.set('Expires', '0');
|
|
71
|
+
res.set('Surrogate-Control', 'no-store');
|
|
72
|
+
next();
|
|
73
|
+
});
|
|
74
|
+
|
|
66
75
|
app.get('/api/health', (_, res) => res.json({ status: 'ok' }));
|
|
67
76
|
app.get('/api/conversations', (_, res) => res.json(listConversations()));
|
|
68
77
|
app.get('/api/conversations/:id', (req, res) => {
|