Spaces:
Running
Running
fix: use GATEWAY_TOKEN as Jupyter token fallback when JUPYTER_TOKEN unset
Browse fileshealth-server.js starts before start_jupyter_once() runs, so
process.env.JUPYTER_TOKEN is empty in Node. Mirror start.sh fallback:
if JUPYTER_TOKEN is unset or "huggingface", use GATEWAY_TOKEN instead —
that's what Jupyter is started with, so the injected header now matches.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- health-server.js +4 -1
health-server.js
CHANGED
|
@@ -632,7 +632,10 @@ const server = http.createServer(async (req, res) => {
|
|
| 632 |
}
|
| 633 |
if (!requireAuth(req, res)) return;
|
| 634 |
// Inject the Jupyter token so JupyterLab skips its own login screen.
|
| 635 |
-
|
|
|
|
|
|
|
|
|
|
| 636 |
return proxyHTTP(req, res, JUPYTER_HOST, JUPYTER_PORT, {
|
| 637 |
publicPrefix: JUPYTER_BASE,
|
| 638 |
// Jupyter is started with --ServerApp.base_url=/terminal/, so keep the
|
|
|
|
| 632 |
}
|
| 633 |
if (!requireAuth(req, res)) return;
|
| 634 |
// Inject the Jupyter token so JupyterLab skips its own login screen.
|
| 635 |
+
// Mirror start.sh logic: JUPYTER_TOKEN falls back to GATEWAY_TOKEN when
|
| 636 |
+
// unset or still the insecure default — that's what Jupyter was started with.
|
| 637 |
+
const rawJupyterToken = (process.env.JUPYTER_TOKEN || "").trim();
|
| 638 |
+
const jToken = (!rawJupyterToken || rawJupyterToken === "huggingface") ? GATEWAY_TOKEN : rawJupyterToken;
|
| 639 |
return proxyHTTP(req, res, JUPYTER_HOST, JUPYTER_PORT, {
|
| 640 |
publicPrefix: JUPYTER_BASE,
|
| 641 |
// Jupyter is started with --ServerApp.base_url=/terminal/, so keep the
|