billions-minister-2901
05/16/2025, 2:42 PMbrief-egg-61061
05/16/2025, 2:42 PMbrief-egg-61061
05/16/2025, 2:42 PMhttps://*.<http://yourdomain.com|yourdomain.com>
), but you cannot use *
, null
, or localhost/127.0.0.1
as origins. For local development, use [Ory Tunnel](https://www.ory.sh/docs/guides/cli/proxy-and-tunnel) instead of adding localhost
directly as a CORS origin [Set up CORS for Ory Network](https://www.ory.sh/docs/guides/cors/), [Set up custom domains](https://www.ory.sh/docs/guides/custom-domains/). 2. Via Ory CLI: - You can enable and set CORS origins using the CLI with the following command: ory patch project <your-project-id> \ --replace '/cors_public/enabled=true' \ --replace '/cors_public/origins=["https://*.<http://yourdomain.com|yourdomain.com>"]'
- This command enables CORS and sets the allowed origins. For more details, see the [Ory CLI documentation](https://www.ory.sh/docs/guides/cli/config-with-cli#patch-configuration) [Set up CORS for Ory Network](https://www.ory.sh/docs/guides/cors/). 3. OAuth2 Client-Specific CORS: - For OAuth2 endpoints, you can also set per-client CORS origins in the OAuth2 client settings in the Ory Console. These settings are respected in addition to the global CORS settings [Set up CORS for Ory Network](https://www.ory.sh/docs/guides/cors/), [Setting up cross-origin resource sharing (CORS)](https://www.ory.sh/docs/hydra/guides/cors/). Note: - CORS is enabled by default on custom domains, but you must explicitly add the allowed origins. - For local development, use Ory Tunnel to proxy requests and handle CORS for localhost
[Set up custom domains](https://www.ory.sh/docs/guides/custom-domains/). If you need more specific instructions for your use case (e.g., Kratos, Hydra, or Keto), let me know!billions-minister-2901
05/16/2025, 2:45 PMbrief-egg-61061
05/16/2025, 2:45 PMbrief-egg-61061
05/16/2025, 2:45 PM<https://dev.yourdomain.com>
) in the list of allowed origins. 3. CORS Restrictions: - Ory Network does not allow *
, null
, or localhost/127.0.0.1
as CORS origins. - You can use wildcard subdomains like https://*.<http://yourdomain.com|yourdomain.com>
, but Ory recommends using exact matches for better security. - For local development with localhost
, use [Ory Tunnel](https://www.ory.sh/docs/guides/cli/proxy-and-tunnel) instead of adding localhost
directly as a CORS origin. 4. Propagation: After updating your CORS settings, it may take some time for changes to propagate. The CORS status will show as "Inactive" while pending, and "Enabled" once active. You can update CORS settings independently of other custom domain settings [Set up custom domains](https://www.ory.sh/docs/guides/custom-domains/#waiting-for-propagation). Example: If your dev domain is <https://dev.yourdomain.com>
, add this exact URL to the allowed CORS origins in the Ory Console. If you want to allow all subdomains, you can use https://*.<http://yourdomain.com|yourdomain.com>
[Set up CORS for Ory Network](https://www.ory.sh/docs/guides/cors/), [Set up custom domains](https://www.ory.sh/docs/guides/custom-domains/). Note: If you encounter issues with CORS not being applied, ensure your domain is verified and active. There have been reports of CORS headers not being set correctly if the domain is still pending or if there are configuration issues [Cors doesn't seem to be activated with a custom domain on ory cloud](https://github.com/ory/network/issues/124). If you need to allow requests from a local development environment (e.g., localhost
), use Ory Tunnel for local development, as Ory Network does not allow localhost
as a CORS origin [Set up CORS for Ory Network](https://www.ory.sh/docs/guides/cors/). Let me know if you need step-by-step instructions for a specific scenario!