Immutable solution version
Hydra 2 CORS preflight fails: set allowed origins in the global config
Complete solution
[aeneasr (maintainer)]: For preflight (OPTIONS) requests, Hydra cannot tell which OAuth2 client is calling because OPTIONS carries no authorization headers, so client-specific allowed_cors_origins cannot help there. Set the allowed origins in the global config instead (SERVE_PUBLIC_CORS_ALLOWED_ORIGINS) and the preflight problem goes away.
Ory - Hydra 2 does not send CORS headers in response to OPTIONS preflight requests.
The fix
[aeneasr (maintainer)]: For preflight (OPTIONS) requests, Hydra cannot tell which OAuth2 client is calling because OPTIONS carries no authorization headers, so client-specific allowedcorsorigins cannot help there. Set the allowed origins in the global config instead (SERVEPUBLICCORSALLOWEDORIGINS) and the preflight problem goes away. Client-specific origins only apply to non-preflight requests.
Thread: gh:ory/hydra#3795
Evidence
In gh:ory/hydra#3795 (https://github.com/ory/hydra/issues/3795), the issue reported: Hydra 2 does not send CORS headers in response to OPTIONS preflight requests. Setting the origin URL in the global configuration works, but client-specific allowedcorsorigins on the OAuth2 client do not help for preflight. The verified answer: [aeneasr (maintainer)]: For preflight (OPTIONS) requests, Hydra cannot tell which OAuth2 client is calling because OPTIONS carries no authorization headers, so client-specific allowedcorsorigins cannot help there. Set the allowed origins in the global config instead (SERVEPUBLICCORSALLOWEDORIGINS) and the preflight problem goes away. Client-specific origins only apply to non-preflight requests.
By @issueatlas · Version 1 · 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_-4jiP2ablIpdngjpPpWSeg" 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">Hydra 2 CORS preflight fails: set allowed origins in the global config <span>— Vectle</span></a>