important-engineer-54926
10/15/2025, 7:50 AM/auth/login, I get a global error:
Root error boundary: Error: An error occurred in the Server Components render.• Previously, there was also a CORS error, but after adding the production URL somewhere in the config, that one seems to be fixed. After build + `yarn start`: I’m redirected to
Development: I was able to log in successfully for weeks at localhost:3000 • I’m not sure if I was using a tunnel, but it worked fine until I changed something in the Ory console — specifically under Custom UI URLs for Ory Kratos. • I changed it fromhttps://<PROD_URL>/self-service/login/browser?
/ui/login to /auth/login (now reverted), and since then I’ve been getting an error when trying to access the /auth/login page locally as well.
The implementation follows this doc exactly: https://www.ory.com/docs/getting-started/integrate-auth/nextjs-app-router-quickstart
Could you please help me out with that? 🙏important-engineer-54926
10/15/2025, 2:36 PMRecord Type: CNAME
Key: admin
Value: <project_slug>
However, there’s some confusion here:
• The ‘admin’ CNAME probably shouldn’t point to Ory unless we want it to act as the frontend server (which isn’t our intention).
• Should we instead create an ‘auth’ subdomain just for cookie handling and redirects (e.g. to prod url)?
• The example in the docs uses <http://auth.example.com|auth.example.com>, but it’s not clear if that’s just a sample app name or if it must actually be the subdomain Ory manages.
• Also, we’re still seeing requests from ory/react SDK to prod url, so DNS alone can’t explain all of this.
I’d really appreciate any clarification on:
1. The correct setup for CNAME + Ory Network custom domain when the frontend app is hosted separately (Vercel).
2. Whether an auth. subdomain is required or optional.
3. Any tips on configuring CORS/public URLs correctly for production (to avoid redirecting to the default <http://projects.oryapis.com|projects.oryapis.com> domain).magnificent-energy-493
auth. is a common convention for authentication endpoints. Your frontend (e.g., on Vercel) can remain on a separate domain or subdomain, but for cookies to work seamlessly, both should share the same root domain (e.g., <http://www.example.com|www.example.com> and <http://auth.example.com|auth.example.com>)
You can use any subdomain you prefer, but the key is that the subdomain you configure as your Ory custom domain is where Ory will serve its APIs and set cookies.
After setting up your custom domain, you must explicitly add your frontend’s production URL(s) as allowed CORS origins in the Ory Console.
In the Ory Console under Branding → UI URLs, set the base URL and paths for your custom UI (e.g., /auth/login).
If you see redirects to the default Ory domain, it usually means the custom domain is not set up correctly, or the SDK is still configured to use the default endpoint.important-engineer-54926
10/17/2025, 6:13 AM/auth/login)?magnificent-energy-493
we’re trying to understand why a custom domain and explicit CORS configuration are required in production when everything works fine locally without them.Local development works because Ory Tunnel mirror Ory APIs on your local machine, exposing them under the same domain (e.g.,
localhost). This ensures cookies and CORS are not an issue, as both your app and Ory appear to be on the same origin to the browser.
In production, your app and Ory APIs are on different domains. Browsers enforce strict same-origin policies, so cross-origin requests require explicit CORS headers and correct cookie domains.
clarify whether setting a custom domain is strictly necessary for session cookies to work correctly in this setup, and what exactly changes between localhost and production in that regard?Ory can only set cookies for its own domain. If you use the default Ory domain (
*.<http://projects.oryapis.com|projects.oryapis.com>), the browser will not send those cookies to your app's domain, breaking session management. By setting up a custom domain (e.g., <http://ory.example.com|ory.example.com>), Ory can issue cookies for <http://example.com|example.com>
If the custom domain is not set up or misconfigured, Ory will default to its own domain (*.<http://projects.oryapis.com|projects.oryapis.com>) for redirects and API calls. This can cause:
• Redirects to the Ory domain instead of your app (breaking the flow).
• Session cookies being set for the wrong domain (not accessible to your app).
• CORS errors, since the browser sees cross-origin requests without the proper headers.
I hope this makes it clearer.
CORS is a common headache, but unfortunately we need to deal with it...important-engineer-54926
10/24/2025, 9:31 AMguessPotentiallyProxiedOrySdkUrl() resolves to origin, which correctly proxies requests through our Next.js middleware and everything works as expected.
However, in production (where NODE_ENV === "production"), it switches to orySdkUrl, causing the browser to directly hit the Ory endpoint (<http://projects.oryapis.com|projects.oryapis.com>) instead of our app proxy.
This explains the redirect to the hosted Ory UI and the CORS/session problems we’re seeing. This behavior makes sense if the app is hosted on a vercel.app domain (which Ory can detect), but in our case, while hosted on Azure it breaks the flow.
We’re wondering:
1. Is this switch between origin and orySdkUrl intentional, or is it a known issue / limitation in the SDK?
2. Would it be safe to override guessPotentiallyProxiedOrySdkUrl or force it to always use origin in our setup (since all requests are proxied through Next middleware)?
3. If our proxy works properly and the browser never talks directly to Ory, is a custom domain still strictly required for cookies and session handling?
4. Do you plan to make this logic configurable for non-Vercel deployments in future releases?
Here’s a GitHub issue that describes a nearly identical problem:
🔗 https://github.com/ory/elements/issues/572
We’d really appreciate your insight or confirmation on whether this is an SDK bug or just an unsupported deployment pattern. Thanks again 🙏magnificent-energy-493
guessPotentiallyProxiedOrySdkUrl before but you should be able to always use orySdkUrl or override it.
If our proxy works properly and the browser never talks directly to Ory, is a custom domain still strictly required for cookies and session handling?I don't really understand what you mean by proxy, but I think you definitely want to use a custom domain. There might be hacks/workarounds but those are not tested and can break.
Do you plan to make this logic configurable for non-Vercel deployments in future releases?That would be good probably! I'm not sure how big the portion of non-Vercel users is for Next.js but probably not insubstantial. @bland-eye-99092 sorry for the ping but you worked on this maybe you have a better answer 😅
bland-eye-99092
10/24/2025, 11:30 PMchilly-engine-67841
10/25/2025, 4:31 PMchilly-engine-67841
10/25/2025, 4:36 PMknownProxiedUrl, aka getPublicUrl. Perhaps there's a use case others have where they want to direct to the Ory-hosted login that this is trying to account for.chilly-engine-67841
11/03/2025, 5:38 PMbland-eye-99092
11/10/2025, 3:36 PM