[Bug]: Capacitor WebView treats URLs with dots as file requests, breaking SPA routing and page reload.
维护者通常 1 天内回复
还没有人认领这个 Issue。
- #8135 来自 @iamriajul —— 已关闭,未合并
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 48/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- android, ios, typescript
调研方向
首先,在 iOS 和 Android 上使用链接的 Capacitor 项目复现该问题,重点关注包含点的路由的 WebView 导航。将这些请求与资源请求进行比较,并验证非资源 URL 会提供 index.html,以确保 SPA 路由和页面重新加载在两个平台上都能正常工作。
由索引模型根据 Issue 内容生成。
描述
Capacitor Version
💊 Capacitor Doctor 💊
Installed Dependencies:
@capacitor/cli: 7.4.2
@capacitor/core: 7.4.2
@capacitor/android: 7.4.2
@capacitor/ios: 7.4.2
[success] iOS looking great! 👌
[success] Android looking great! 👌
Other API Details
Platforms Affected
- iOS
- Android
- Web
Current Behavior
When navigating to URLs that contain dots (.) in the path, Capacitor's WebView treats them as file requests rather than SPA routes. This causes a 404 error instead of serving the index.html file for client-side routing.
For example:
http://localhost/@username→ Works (serves index.html)http://localhost/@user.name→ Fails (404 - treats as file request)http://localhost/page.section→ Fails (404 - treats as file request)
And shows console error in Xcode:
⚡️ WebView failed provisional navigation
⚡️ Error: The file “@user.name” couldn’t be opened because there is no such file.
And in Android, An error page is shown with Page is not available.
Expected Behavior
All non-asset URLs should serve index.html to allow the SPA router to handle routing, regardless of whether the URL contains dots.
Project Reproduction
https://github.com/iamriajul/capacitor-dot-in-urls-spa-navigation-issue-reproduction
Additional Information
No response
- 主要语言
- TypeScript
- 星标
- 17.1k
- 派生
- 1.3k
- 平均合并
- 1 天 22 小时
- 30 天内合并 PR
- 26
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
ionic-team/capacitor 的其他 Issue
-
triage
难度 2/5 1-3 小时 新手友好度 76/100
ionic-team/capacitor#8759 ·
维护者通常 1 天内回复
-
[Bug]: Plugin call after navigation can be answered before reply proxy is updated可能已有人在做 @MateStrysewske 于 71 天前认领。 未关闭triage
难度 2/5 1-3 小时 新手友好度 84/100
ionic-team/capacitor#8616 ·
维护者通常 1 天内回复
-
help wanted
难度 2/5 1-3 小时 新手友好度 68/100
ionic-team/capacitor#8574 · 3 条评论 ·
维护者通常 1 天内回复
-
SystemBars: safe area CSS injection throws "Cannot read properties of null" on startup (Android 16)可能已有人在做 @kttalley 于 62 天前认领。 未关闭triage
难度 2/5 1-3 小时 新手友好度 78/100
ionic-team/capacitor#8530 · 2 条评论 ·
维护者通常 1 天内回复
-
fix(android): remove unchecked Java compilation warnings可能已有人在做 @Ajamuar 于 15 天前认领。 未关闭triage
难度 2/5 1-3 小时 新手友好度 78/100
ionic-team/capacitor#8529 · 1 条评论 ·
维护者通常 1 天内回复
查看 ionic-team/capacitor 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 84/100
eliasstravik/herdr-projects#1700 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 75/100
Koenkk/zigbee2mqtt#33890 ·
维护者通常 1 天内回复
-
[bug] Socrates launchd-path adapter throws EISDIR when an import names a folder beside its .ts file未关闭
难度 2/5 1-3 小时 新手友好度 85/100
danielmiessler/LifeOS#3123 ·
维护者通常 5 天内回复
-
[Feature]: Skill Workshop skill diet should use the configured utility model, not always the primary未关闭clawsweeper:fix-shape-clear clawsweeper:needs-live-repro clawsweeper:needs-maintainer-review clawsweeper:needs-product-decision clawsweeper:no-new-fix-pr impact:auth-provider issue-rating: 🐚 platinum hermit P2
难度 2/5 1-3 小时 新手友好度 84/100
openclaw/openclaw#210348 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复