Open RokoTechnology opened 1 year ago
actually, i think the root cause is not in the FrontendApi but in the @ory/integrations/next-edge here https://github.com/ory/integrations/blob/84858eafd718cc28682ca4cc2d713e86b0b36de8/src/next-edge/index.ts#L178
i made a PR which should resolve my issue. you could pass appBasePath: myNextConfig.basePath
to the createApiHandler
I am running OpenFAAS based setup with multiple servers on different sub paths of same domain -
mydomain.com/function/app1
,mydomain.com/function/app2
etc.Now i'm trying to set up a Next + Ory app at
mydomain.com/function/nextapp
I am using Next.js 12 with @ory/client 1.1.4 and @ory/integrations 1.1.0
pages/api/.ory/[...paths].js
as suggested at https://github.com/ory/integrations#nextjspages/index.js
session detection try/catch and router.push redirect as suggested at https://www.ory.sh/docs/getting-started/integrate-auth/nextjsORY_SDK_URL
set up properly in my environmentI have a
basePath: '/function/nextapp'
in mynext.config.js
because I need the ory login pages to live onmydomain.com/function/nextapp/api/.ory/ui/login
instead ofmydomain.com/api/.ory/ui/login
Unfortunately, no matter what I try, I always end up being redirected to
mydomain.com/api/.ory/ui/login?flow=...
mydomain.com/function/nextapp/api/.ory/ui/login
router.push('mydomain.com/function/nextapp/api/.ory/ui/login')
/function/nextapp/api/.ory/
when instantiating FrontendApi such asnew FrontendApi(new Configuration({ basePath: 'mydomain.com/function/nextapp/api/.ory/ui/login' }))
Looks like the currently suggested Next + Ory setup ignores the
next.config.js
basePath and it is not possible to override it manually either. Looks like the FrontendApi ignores edgeConfig and always redirects to the root relative basePath/api/.ory/ui/login