shadcn.io is not affiliated with official shadcn/ui
CORS Policies Dashboard Block for React
Six allowed origins with an editor for methods, headers, credentials and max-age, and a preflight preview that shows the response headers a server would send or why the request is blocked.
Installation
Overview
Check what a browser will be told before it asks, with this CORS policies panel for React with Base UI. A hairline frame with a plus mark on each corner lists six allowed origins at the start, one of them a wildcard that matches any preview subdomain. Choosing an origin opens its editor: the methods as toggle pills, the allowed headers in a Tags Input, a Switch for credentials and a Native Select for how long a browser may cache the answer. A field adds an origin after checking its shape. The preview band takes an origin, a method and a header and shows the six response headers the server would send in a definition list, or "Blocked: origin not allowed" and why the method or header fails. Editing a policy re-runs the last preview. The Preview button is a Shine Button. For API gateways and developer consoles.
FAQ
How do I fill it with my origins?
Edit POLICIES. Each has an origin (exact, or with a * label such as https://*.preview.wicketgate.example), the allowed methods, the allowed headers in lower case, a credentials flag and a maxAge in seconds. The list, the editor and the preview all read the same array.
How is the origin matched?
An exact origin wins first. Otherwise the first wildcard whose start and end fit the origin and whose middle is a non-empty host part with no slash wins, so a preview host matches the wildcard and the bare domain does not. If nothing matches, the preview is blocked with "origin not allowed". A method or header that the matched policy does not list blocks it with its own reason.
Why does the answer name the origin when credentials are on?
A browser refuses a wildcard in the allowed origin when credentials are sent, so a policy echoes the request's own origin and adds Vary: Origin so caches keep one answer per origin. The preview shows exactly that, and shows the credentials header as "not sent" when the switch is off.
What stays local, and how do I wire it for real?
The policies, edits and previews are all in this page and nothing is saved or sent. To make it real, load the policies from your gateway, write changes back through its API and keep the matching function so the preview agrees with what the server answers.