Manifest <link> emits without crossorigin, breaking deployments behind credential-gated reverse proxies
Problem
When ao-web is fronted by a reverse proxy that gates the dashboard hostname on a session cookie (Cloudflare Access, oauth2-proxy, Pomerium, Tailscale Funnel + Serve auth, etc.), every page load logs a CORS error in the browser console and the PWA manifest never loads:
Access to manifest at 'https://<proxy-sso-origin>/cdn-cgi/access/login/<hostname>?...'
(redirected from 'https://<hostname>/manifest.webmanifest')
from origin 'https://<hostname>' has been blocked by CORS policy:
No 'Access-Control-Allow-Origin' header is present on the requested resource.
The rest of the dashboard works (HTML, JS, CSS, same-origin API calls all default to sending credentials), but the manifest fetch never carries the auth cookie, so the proxy 302s it to its SSO login on a different origin, and the browser blocks the cross-origin response with CORS.
Root cause
<link rel="manifest"> is one of the few same-origin browser fetches that, by spec, omits credentials unless explicitly opted in via crossorigin="use-credentials". The current app/manifest.ts Next.js special file auto-emits the link tag with no way to set that attribute.
Next.js's <link rel="manifest"> emission (next/dist/lib/metadata/generate/basic.js) sets crossOrigin to 'use-credentials' only when process.env.VERCEL_ENV === 'preview':
metadata.manifest ? jsx("link", {
rel: "manifest",
href: metadata.manifest.toString(),
// If it's same origin, and it's a preview deployment,
// including credentials for manifest request.
crossOrigin: !manifestOrigin && process.env.VERCEL_ENV === 'preview' ? 'use-credentials' : undefined
}) : null,
This solves Vercel's own basic-auth-gated preview deployments but offers no equivalent for self-hosted deployments behind credential-gated proxies. The metadata.manifest Metadata API accepts only a string URL — there's no options object exposing crossorigin.
See vercel/next.js#65964 for the inverse complaint (users who got crossorigin="use-credentials" auto-added in Next 14 and couldn't remove it for their public manifests). Together, the two cases are evidence that the Metadata API needs a crossorigin knob; the Vercel-preview gate is a one-sided heuristic.
Use case
Running the AO dashboard on a public hostname fronted by Cloudflare Tunnel + Cloudflare Access. The Access policy gates every request on a session cookie set by Cloudflare's SSO flow. This setup is what makes the dashboard reachable from anywhere (mobile, away-from-machine, multi-device) without exposing the orchestrator process to the public internet. The manifest CORS errors are loud and confusing in the console, and the PWA manifest never loads — so install prompts, theme color metadata, and standalone-display behavior all silently fail.
The same pattern would affect any AO operator running behind oauth2-proxy, Pomerium, Tailscale Funnel with auth, or any similar credential-gated reverse proxy.
Proposed fix
Emit the <link rel="manifest"> tag manually in layout.tsx with crossOrigin="use-credentials", and serve the manifest JSON via a regular Route Handler instead of the app/manifest.ts special file. Next's Metadata API doesn't expose crossorigin on metadata.manifest, so the manual emit is the only way to set it on a self-hosted deployment.
Shape of the change (4 files in packages/web/):
src/lib/pwa-manifest.ts— extract the existing manifest-building helper as a pure function.src/app/manifest.webmanifest/route.ts— regular Route Handler that imports the helper and returnsapplication/manifest+json. Same URL, same content.src/app/manifest.ts— delete (this is the Next special file that auto-emits the link tag withoutcrossorigin).src/app/layout.tsx— emit<link rel="manifest" href="/manifest.webmanifest" crossOrigin="use-credentials" />explicitly in<head>.src/app/manifest.test.ts— update the import to point at the extracted helper. (3 existing assertions unchanged.)
No change to the manifest content, the URL, or behavior for non-proxied deployments. Same-origin fetches now carry credentials, so any future auth-gated proxy in front of AO works without operator-side path bypasses.
Verified locally (Next.js 15.5.15):
- Server HTML emits exactly one
<link rel="manifest" href="/manifest.webmanifest" crossorigin="use-credentials"/>. - DOM after hydration: same;
link.crossOrigin === "use-credentials". - Manifest URL:
200 application/manifest+json(in-browser request carries the cookie, proxy validates, dashboard works end-to-end). - All existing tests pass.
Happy to send a PR if this direction is acceptable.
Repro
- Run AO behind any reverse proxy that gates the dashboard hostname on a session cookie (Cloudflare Access is the easy one — set up Cloudflare Tunnel pointed at the local dashboard, then add an Access policy on the hostname requiring SSO).
- Sign in via SSO in a fresh browser session.
- Open the dashboard in Chrome with the console open.
- Observe: manifest fetch redirects to the SSO origin → CORS error logged on every page load. The dashboard otherwise functions normally.
References
- vercel/next.js#65964 — inverse case (auto-added crossorigin breaking public manifests).
- Next.js manifest link emission source — the conditional that omits
crossoriginoutside of Vercel preview. - MDN:
<link rel="manifest">and credentials — same-origin manifest fetches omit credentials by default.
closes #2008
problem: when running the dashboard behind credential-gated reverse proxies (like cloudflare access or oauth2-proxy), same-origin manifest fetches omit credentials by default, leading to cors errors and blocking the pwa manifest from loading.
solution:
extract manifest builder as a pure function in pwa-manifest.ts serve the manifest JSON via a route handler in manifest.webmanifest/route.ts delete manifest.ts to stop next.js auto-emitting a link tag without crossorigin emit the manifest link manually in layout.tsx with crossOrigin="use-credentials"
This issue was created before the AO rewrite and is no longer relevant to the current codebase, so we’re closing it as part of the repository cleanup.
AO is now available as an app on macOS and Windows, with iOS currently in beta and Android coming soon.
If the issue still exists in the latest version of AO, feel free to open a new issue with updated details, reproduction steps, logs, and screenshots where applicable.
Stay connected with AO:
GitHub: https://github.com/AgentWrapper/agent-orchestrator Discord: https://discord.gg/kGbBRRDPv X: https://x.com/aoagents LinkedIn: https://www.linkedin.com/company/agent-orchestrator Instagram: https://www.instagram.com/aoagents