configure-cors
Installation
SKILL.md
Configure CORS in ABP
CORS controls which browser origins (scheme + host + port) are allowed to call your HTTP API from client-side JavaScript. In ABP you configure it on the API host (the HttpApi.Host project), using ASP.NET Core's CORS with one ABP-specific helper (WithAbpExposedHeaders). The allowed origins come from the App:CorsOrigins setting.
This is not the same as OpenIddict redirect URIs, AppUrlOptions, or RedirectAllowedUrls — see When Not to Use.
When to Use
- A browser SPA (Angular/React/Blazor WASM) or another site calls your ABP API and the browser blocks it with a CORS error.
- Adding/removing allowed origins, or supporting wildcard subdomains.
- Getting
UseCorsinto the pipeline in the right order. - Deciding where CORS goes in a tiered or microservice solution (API host vs gateway).
When Not to Use
- OpenIddict allowed redirect / post-logout URIs for the OAuth flow — these are the OpenIddict client application's registered URIs (set when the client/application is created or seeded), not a CORS setting. (A login redirect failing is not a CORS problem.)
AppUrlOptionsnamed app URLs andRedirectAllowedUrls(server-side redirect allow-list) — use the configure-app-urls skill.- Antiforgery/CSRF and security response headers (CSP etc.) — use the secure-web-requests skill.
- Calling a remote HTTP API from C# (no browser, no CORS) — use the consume-remote-services skill.