Wrong redirect when using self-hosted Kratos
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 38/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- nextjs, typescript
调研方向
从 packages/nextjs/src/utils/rewrite.ts 中链接的 matching 逻辑开始,然后使用 self-hosted Kratos 配置以及不同的 auth 和 application 域名复现一个流程。确定已配置 UI URL 的预期重定向行为;如果 repository 提供了相应机制,则添加或更新针对性的 coverage,并验证该流程不再错误地回退到 backend URL。
由索引模型根据 Issue 内容生成。
描述
Hello!
I'm not sure if I am doing something wrong, but it seems there is an assumption here that may not be correct in cases of self-hosted Kratos:
https://github.com/ory/elements/blob/fdabadf8cb2e0ec4fd9286a5277516f8fd69aa0c/packages/nextjs/src/utils/rewrite.ts#L32C1-L32C62
In my Kratos config, I have:
kratos:
kratos:
config:
serve:
public:
base_url: https://auth.example.com
cors:
allowed_origins:
- http://localhost:3042
- https://auth.example.com
selfservice:
default_browser_return_url: https://example.com
allowed_return_urls:
- http://localhost:3042/*
- https://example.com/*
methods:
webauthn:
config:
rp:
id: example.com
origin: https://example.com:443/auth/login
flows:
error:
ui_url: https://example.com/error
settings:
ui_url: https://example.com/settings
recovery:
ui_url: https://example.com/auth/recovery
verification:
ui_url: https://example.com/auth/verification
after:
default_browser_return_url: https://example.com
logout:
after:
default_browser_return_url: https://example.com
login:
ui_url: https://example.com/auth/login
registration:
ui_url: https://example.com/auth/registration
Every time I start a flow, I get redirected to the UI URLs specified in the config, as-is.
In the linked code above, we can see it tries to match the base URL (let's say https://auth.example.com with the redirect https://example.com/auth/login). Of course, this do not match, it gives up and returns the URL as-is from the backend. It seems a bit weird to me that Ory HAS to be hosted on the same domain as the actual app handling the flows. I suppose this is something specific to the hosted version of Kratos/Ory services, and I also suppose the headers passed are supposed to mitigate this issue, but they do not have any effects in the self-hosted version, it seems.
I'm absolutely open to making a PR if required; I just want to make sure there was no oversight on my side first!
Thanks a lot.
- 主要语言
- TypeScript
- 星标
- 187
- 派生
- 80
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
ory/elements 的其他 Issue
-
Needs Triage
难度 2/5 1-3 小时 新手友好度 70/100
-
Needs Triage
难度 5/5 一周以上 新手友好度 22/100
-
enhancement
难度 3/5 1-2 天 新手友好度 72/100
-
good first issue help wanted upstream
难度 2/5 1-3 小时 新手友好度 45/100
-
good first issue help wanted upstream
难度 3/5 1-2 天 新手友好度 25/100
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 74/100
paperclipai/paperclip#17151 ·
维护者通常 1 天内回复
-
needs-triage
难度 2/5 1-3 小时 新手友好度 83/100
AgoraIO-Extensions/agent-infra#3159 ·
维护者通常 1 天内回复
-
blocklist addition
难度 1/5 1 小时以内 新手友好度 66/100
MetaMask/eth-phishing-detect#304596 ·
维护者通常 1 天内回复
-
friction
难度 2/5 1-3 小时 新手友好度 70/100
kentcdodds/kody#4142 ·
-
[Bug] Statistics | Task statistics are always empty on MikroORM with MySQL or SQLite可能已有人在做 @NdekoCode 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
ever-co/ever-gauzy#11214 ·
维护者通常 1 天内回复