gitnexus 1.6.6-rc.28 → 1.6.6-rc.29
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/dist/server/api.js +7 -14
- package/package.json +1 -1
package/dist/server/api.js
CHANGED
|
@@ -597,6 +597,13 @@ export const createServer = async (port, host = '127.0.0.1') => {
|
|
|
597
597
|
// host in those topologies (tracked as a follow-up; not blocking for the
|
|
598
598
|
// local-bound default).
|
|
599
599
|
app.set('trust proxy', 'loopback, linklocal, uniquelocal');
|
|
600
|
+
// Chromium Private Network Access (required since Chrome 130+). Must run before
|
|
601
|
+
// cors: the cors middleware ends OPTIONS preflight responses, so this header
|
|
602
|
+
// has to be set on res before cors writes the preflight reply.
|
|
603
|
+
app.use((_req, res, next) => {
|
|
604
|
+
res.setHeader('Access-Control-Allow-Private-Network', 'true');
|
|
605
|
+
next();
|
|
606
|
+
});
|
|
600
607
|
// CORS: allow localhost, private/LAN networks, and the deployed site.
|
|
601
608
|
// Non-browser requests (curl, server-to-server) have no origin and are allowed.
|
|
602
609
|
// Disallowed origins get the response without Access-Control-Allow-Origin,
|
|
@@ -608,20 +615,6 @@ export const createServer = async (port, host = '127.0.0.1') => {
|
|
|
608
615
|
},
|
|
609
616
|
}));
|
|
610
617
|
app.use(express.json({ limit: '10mb' }));
|
|
611
|
-
// Support Chromium Private Network Access (required since Chrome 130+).
|
|
612
|
-
// Without this header, Chrome/Edge/Brave/Arc block public->loopback requests
|
|
613
|
-
// which breaks bridge mode entirely.
|
|
614
|
-
app.use((_req, res, next) => {
|
|
615
|
-
res.setHeader('Access-Control-Allow-Private-Network', 'true');
|
|
616
|
-
next();
|
|
617
|
-
});
|
|
618
|
-
// Handle PNA preflight: Chromium sends Access-Control-Request-Private-Network
|
|
619
|
-
// on OPTIONS requests and expects the allow header in the response.
|
|
620
|
-
// Note: the actual Allow-Private-Network header is already set by the global
|
|
621
|
-
// middleware above, so we just need to call next() here.
|
|
622
|
-
app.options('*', (_req, res, next) => {
|
|
623
|
-
next();
|
|
624
|
-
});
|
|
625
618
|
// Initialize MCP backend (multi-repo, shared across all MCP sessions)
|
|
626
619
|
const backend = new LocalBackend();
|
|
627
620
|
await backend.init();
|
package/package.json
CHANGED