osborn 0.9.154 → 0.9.155
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/Dockerfile.sandbox +1 -0
- package/dist/index.js +31 -0
- package/package.json +1 -1
package/Dockerfile.sandbox
CHANGED
|
@@ -101,6 +101,7 @@ ENV OSBORN_CWD=/workspace
|
|
|
101
101
|
# Caveat: native user modules are tied to the image's Node ABI (currently 22) —
|
|
102
102
|
# a future Node-major image bump would need an `npm rebuild` of volume globals.
|
|
103
103
|
ENV NPM_CONFIG_PREFIX=/workspace/.npm-global
|
|
104
|
+
ENV NPM_CONFIG_CACHE=/tmp/npm-cache
|
|
104
105
|
ENV PATH=/workspace/.npm-global/bin:$PATH
|
|
105
106
|
|
|
106
107
|
WORKDIR /workspace
|
package/dist/index.js
CHANGED
|
@@ -1528,6 +1528,37 @@ function startApiServer(workingDir, port) {
|
|
|
1528
1528
|
return;
|
|
1529
1529
|
}
|
|
1530
1530
|
// ────────────────────────────────────────────────────────────────────────
|
|
1531
|
+
// ── Port proxy: /proxy/PORT/* → localhost:PORT/proxy/PORT/* ─────────────
|
|
1532
|
+
// Forwards to a local dev server while PRESERVING the full path so that
|
|
1533
|
+
// basePath-aware apps (e.g. Next.js with basePath: '/proxy/3000') receive
|
|
1534
|
+
// the complete URL and can strip the prefix themselves. No cookie required —
|
|
1535
|
+
// the machine is per-user and Fly's HTTPS is the outer auth boundary.
|
|
1536
|
+
const portProxyMatch = url.pathname.match(/^\/proxy\/(\d+)(\/.*)?$/);
|
|
1537
|
+
if (portProxyMatch) {
|
|
1538
|
+
const targetPort = parseInt(portProxyMatch[1]);
|
|
1539
|
+
if (targetPort > 1024 && targetPort < 65536 && targetPort !== 8300 && targetPort !== parseInt(process.env.OSBORN_API_PORT || '8741', 10)) {
|
|
1540
|
+
const portProxyOptions = {
|
|
1541
|
+
hostname: '127.0.0.1',
|
|
1542
|
+
port: targetPort,
|
|
1543
|
+
path: url.pathname + (url.search || ''),
|
|
1544
|
+
method: req.method,
|
|
1545
|
+
headers: { ...req.headers, host: `127.0.0.1:${targetPort}` },
|
|
1546
|
+
};
|
|
1547
|
+
const portProxyReq = httpRequest(portProxyOptions, (portProxyRes) => {
|
|
1548
|
+
res.writeHead(portProxyRes.statusCode || 502, portProxyRes.headers);
|
|
1549
|
+
portProxyRes.pipe(res);
|
|
1550
|
+
});
|
|
1551
|
+
portProxyReq.on('error', () => {
|
|
1552
|
+
if (!res.headersSent) {
|
|
1553
|
+
res.writeHead(502);
|
|
1554
|
+
res.end('Port proxy error');
|
|
1555
|
+
}
|
|
1556
|
+
});
|
|
1557
|
+
req.pipe(portProxyReq);
|
|
1558
|
+
return;
|
|
1559
|
+
}
|
|
1560
|
+
}
|
|
1561
|
+
// ────────────────────────────────────────────────────────────────────────
|
|
1531
1562
|
// ── IDE reverse proxy (cookie-gated fall-through) ────────────────────────
|
|
1532
1563
|
// Forwards to code-server ONLY when:
|
|
1533
1564
|
// 1. ideProxyEnabled is true (code-server is confirmed ready), AND
|