Skip to content

Conversation

@iamriajul
Copy link

Adds a new configuration option routeWithFallback to CapacitorConfig.server that enables fallback to index.html for routes containing dots when the requested file doesn't exist.

This solves the issue where SPA routes like /@user.name or /api/data.json are incorrectly treated as file requests, returning 404 instead of serving index.html for client-side routing.

The feature is disabled by default to maintain backward compatibility. When enabled:

  • iOS: Checks if the file exists before serving, falls back to index.html if not found
  • Android: Catches IOException when file not found, serves index.html as fallback

Fixes #8085

🤖 Generated with Claude Code

Adds a new configuration option `routeWithFallback` to CapacitorConfig.server that enables
fallback to index.html for routes containing dots when the requested file doesn't exist.

This solves the issue where SPA routes like /@user.name or /api/data.json are incorrectly
treated as file requests, returning 404 instead of serving index.html for client-side routing.

The feature is disabled by default to maintain backward compatibility. When enabled:
- iOS: Checks if the file exists before serving, falls back to index.html if not found
- Android: Catches IOException when file not found, serves index.html as fallback

Fixes ionic-team#8085

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@iamriajul iamriajul closed this Sep 2, 2025
@iamriajul
Copy link
Author

Closed in favor of #8137

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Capacitor WebView treats URLs with dots as file requests, breaking SPA routing and page reload.

1 participant