Hey Ory team, I've been dealing with this issue fo...
# ory-network
p
Hey Ory team, I've been dealing with this issue for a while and at this point I am out of clues on what to try next. context: I cloned the example next js app and deployed to vercel and to a ecs (aws) container, the later does not work for some reason, when I try to login in, the ory login element redirects to my ory domain, I have the same problem even with a custom domain... it is the same code, not sure if something in the build process of vercel vs my docker image could be changing this behaviour... I am quite lost honestly! Any tips are welcome.
b
We do some special handling to set the correct base URLs on Vercel. Have you set the
ORY_SDK_URL
environment variable?
p
yeap,
Copy code
"Env": [
      "ORY_SDK_URL=<https://boring-varaham>....",
      "NODE_ENV=production",
      "ORY_PROJECT_ID=927c4f25-d1d....f"
    ],
Now I could reproduce it easily by starting the docker image locally vs
npm run dev
I am going to debug the middelware now, because I can see that in one case
Copy code
/auth/login -> redirects to /self-service/browser...
but when running my docker image
Copy code
/auth/login -> redirects to {ORY_SDK_URL}/self-service/browser...
b
yea when running in dev we proxy the requests to make development as easy as possible. In prod we expect you to configure the project to run on a shared domain. so that it can set cookies on the same domain your custom UI is running on. In that case you'd also configure the UI URLs in the Ory Console to point to your custom UI directly.
p
I see
so there is no way to setup this in my internal dev env where I don't have a domain to test? basically I was trying to workaround the middleware... I configured my ui endpoints and work fine now, but I am never redirected to the correct `my.internal.domain/self-service/login/browser`(which works) ..
my.internal.domain/auth/login/custom
redirects me to
https://{project}.<http://oryapis.com/self-service/login/browser?flow=debad00f-3801-4358-84b6-c20708f45693|oryapis.com/self-service/login/browser?flow=debad00f-3801-4358-84b6-c20708f45693>
which redirects me back to my custom ui and starts a neverending loop. see attached video.
just for some extra context, I wasn't able to test it from my docker image locally I kept getting 403 from ory bc of missing cookies (which makes sense), after deploying my app under a proper domain matching the cookie this worked fine.