ionic-team / ionic-team/capacitor
[Bug]: Capacitor WebView treats URLs with dots as file requests, breaking SPA routing and page reload.
- Dominant language
- TypeScript
- Stars
- 16.7k
- Forks
- 1.3k
- Avg merge
- 3d 15h
- Merged PRs (30d)
- 10
Description
### 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
```Shell
```
### Platforms Affected
- [x] iOS
- [x] 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_
Contributor guide
Assessment
This issue has not been assessed yet.