Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
fix(web): drop Origin on hosted dev proxy requests so docs load over HTTPS (#7243)
Wolf Mermelstein5d1a27808336
diff --git a/apps/web/scripts/hosted-dev-proxy.test.ts b/apps/web/scripts/hosted-dev-proxy.test.tsindex 7c911e2c71..7334e9b678 100644--- a/apps/web/scripts/hosted-dev-proxy.test.ts+++ b/apps/web/scripts/hosted-dev-proxy.test.ts@@ -40,8 +40,11 @@ it('maps dev HTTP and WebSocket URLs while preserving production and OAuth hostsit('forwards authenticated HTTP and WS over HTTPS, rewrites cookies, and rejects other origins', async () => {const sockets = new Set<Socket>();- const upgrades: { cookie: string | undefined; path: string | undefined }[] =- [];+ const upgrades: {+ cookie: string | undefined;+ origin: string | null;+ path: string | undefined;+ }[] = [];let requests = 0;const backend = createHttpServer((req, res) => {requests++;@@ -55,6 +58,7 @@ it('forwards authenticated HTTP and WS over HTTPS, rewrites cookies, and rejectspath: req.url,cookie: req.headers.cookie,host: req.headers.host,+ origin: req.headers.origin ?? null,}));});@@ -63,7 +67,11 @@ it('forwards authenticated HTTP and WS over HTTPS, rewrites cookies, and rejectssocket.on('close', () => sockets.delete(socket));});backend.on('upgrade', (req, socket) => {- upgrades.push({ cookie: req.headers.cookie, path: req.url });+ upgrades.push({+ cookie: req.headers.cookie,+ origin: req.headers.origin ?? null,+ path: req.url,+ });const accept = createHash('sha1').update(`${req.headers['sec-websocket-key']}258EAFA5-E914-47DA-95CA-C5AB0DC85B11`@@ -140,6 +148,7 @@ it('forwards authenticated HTTP and WS over HTTPS, rewrites cookies, and rejectspath: '/auth/user/me?check=1',cookie,host: new URL(upstream).host,+ origin: null,});expect(response.cookies).toEqual([`${cookie}; Path=/; Secure; HttpOnly; SameSite=None`,@@ -186,7 +195,9 @@ it('forwards authenticated HTTP and WS over HTTPS, rewrites cookies, and rejectsreq.end();});await connect(origin);- expect(upgrades).toEqual([{ cookie, path: '/connection-gateway?check=1' }]);+ expect(upgrades).toEqual([+ { cookie, origin: null, path: '/connection-gateway?check=1' },+ ]);await expect(connect('https://unrelated.example')).rejects.toThrow();expect(upgrades).toHaveLength(1);} finally {diff --git a/apps/web/scripts/hosted-dev-proxy.ts b/apps/web/scripts/hosted-dev-proxy.tsindex b3b2688504..85f9bba613 100644--- a/apps/web/scripts/hosted-dev-proxy.ts+++ b/apps/web/scripts/hosted-dev-proxy.ts@@ -44,11 +44,20 @@ export function hostedDevProxy(const rest = path.slice(prefix.length);return rest.startsWith('/') ? rest : `/${rest}`;},+ // isCrossOrigin already vetted the browser's origin. Hosted+ // services allowlist origins (sync-service 403s any https://+ // dev host), so forward like a server-side client.configure(proxy) {+ proxy.on('proxyReq', (request) => {+ request.removeHeader('origin');+ });proxy.on('proxyReqWs', (request, req, socket) => {- if (!isCrossOrigin(req)) return;- request.destroy();- socket.destroy();+ if (isCrossOrigin(req)) {+ request.destroy();+ socket.destroy();+ return;+ }+ request.removeHeader('origin');});},};