Spaces:
Sleeping
Sleeping
fix: accept 302 redirect as healthy in OpenClaw health check
Browse filesThe token-redirect module returns 302 on GET /, which caused
the health check to report 'error' instead of 'idle'.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- scripts/a2a-proxy.cjs +6 -4
scripts/a2a-proxy.cjs
CHANGED
|
@@ -123,13 +123,15 @@ async function pollOpenClawHealth() {
|
|
| 123 |
const controller = new AbortController();
|
| 124 |
const timeout = setTimeout(() => controller.abort(), 5000);
|
| 125 |
const resp = await fetch(`http://127.0.0.1:${OPENCLAW_PORT}/`, {
|
| 126 |
-
signal: controller.signal
|
|
|
|
| 127 |
});
|
| 128 |
clearTimeout(timeout);
|
|
|
|
| 129 |
currentState = {
|
| 130 |
-
state:
|
| 131 |
-
detail:
|
| 132 |
-
progress:
|
| 133 |
updated_at: new Date().toISOString()
|
| 134 |
};
|
| 135 |
} catch (_) {
|
|
|
|
| 123 |
const controller = new AbortController();
|
| 124 |
const timeout = setTimeout(() => controller.abort(), 5000);
|
| 125 |
const resp = await fetch(`http://127.0.0.1:${OPENCLAW_PORT}/`, {
|
| 126 |
+
signal: controller.signal,
|
| 127 |
+
redirect: 'manual'
|
| 128 |
});
|
| 129 |
clearTimeout(timeout);
|
| 130 |
+
const isUp = resp.ok || resp.status === 302;
|
| 131 |
currentState = {
|
| 132 |
+
state: isUp ? 'idle' : 'error',
|
| 133 |
+
detail: isUp ? `${AGENT_NAME} is running` : `HTTP ${resp.status}`,
|
| 134 |
+
progress: isUp ? 100 : 0,
|
| 135 |
updated_at: new Date().toISOString()
|
| 136 |
};
|
| 137 |
} catch (_) {
|