blue-salesclerk-13657
04/17/2025, 3:12 PMblue-salesclerk-13657
04/17/2025, 3:13 PMblue-salesclerk-13657
04/17/2025, 5:22 PMORY_SDK_URL
in the NextJs context. This worked to get the initial login page to render, but caused issues with any links that were included in the SSR'd login page as the URLs for these links would point to the in-cluster URL for kratos.
The fix was to instead use nextjs rewrites, like this:
env: {
NEXT_PUBLIC_ORY_SDK_URL: '/api/kratos',
ORY_SDK_URL: '<http://localhost:3000/api/kratos>', // use absolute URL server-side, which will be stable across deployments
},
async rewrites() {
return [
{
source: '/api/kratos/:path*',
destination: '<http://kratos-public.default.svc.cluster.local:4433/:path*>',
},
];
},
bland-eye-99092
04/22/2025, 7:57 PMblue-salesclerk-13657
04/25/2025, 1:56 PMexport function getOryElementsConfig() {
const kratosUrl = process.env.ORY_SDK_URL || process.env.NEXT_PUBLIC_ORY_SDK_URL || '';
const oryElementsConfig = enhanceOryConfig(baseConfig, kratosUrl);
return {
...oryElementsConfig,
sdk: {
...oryElementsConfig.sdk,
options: {
credentials: "include" as RequestCredentials
}
}
}
}
Is it expected for this to be required?