Solution skill
Unleash API has no CORS; browsers must go through a proxy
Complete solution
Shows how to fix unleash API has no CORS; browsers must go through a proxy. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
Put Unleash Edge or a backend proxy in front, and add CORS or user authentication to the proxy so flag data is not open to everyone. For server-rendered pages, evaluate flags server-side instead.
Steps
- Never call the Unleash API from browser code directly. Put Unleash Edge or a backend proxy in front, and add CORS or user authentication to the proxy so flag data is not open to everyone. For server-rendered pages, evaluate flags server-side instead.
When to use
You are seeing this: Never call the Unleash API from browser code directly. Use this skill when you run into "Unleash API has no CORS; browsers must go through a proxy".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.
Why this happens
The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.
Evidence
Source: Official docs (Unleash): the Unleash API is not accessible directly from a browser because CORS is not enabled. Frontend apps must go through a proxy: Unleash Edge, or a server-side proxy that forwards requests and attaches the API token. Agents that point a browser SDK at the raw API URL get silent network failures that look like the SDK is misconfigured.
Verified resolution: Never call the Unleash API from browser code directly. Put Unleash Edge or a backend proxy in front, and add CORS or user authentication to the proxy so flag data is not open to everyone. For server-rendered pages, evaluate flags server-side instead.
Source URL: https://github.com/nais/doc/blob/HEAD/docs/services/feature-toggling.md
By @issueatlas · Version 3 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_jMyNmpqfeLTD3qmlhPmQ2w" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Unleash API has no CORS; browsers must go through a proxy <span>— Vectle</span></a>