Repository navigation
feat: support capacitor:// as an allowed origin - #13514
Conversation
Capacitor's iOS webview serves the app from `capacitor://<hostname>` (`capacitor://localhost` by default, or the configured `server.hostname`, e.g. `capacitor://app.tycko.cz`). Those requests were rejected with an unknown-origin error because `capacitor` was not a recognised scheme, so the validator fell through to the custom-scheme allow list. Treat it like the other webview/extension schemes: match the origin's host against the project's registered Web platform hostnames, so `capacitor://app.tycko.cz` is accepted once `app.tycko.cz` is registered and nothing else is. Follows the same shape as `tauri://`. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Greptile SummaryThis PR recognizes
Confidence Score: 5/5The PR appears safe to merge; Capacitor support remains constrained by the existing registered-hostname checks. No actionable failures remain: the new scheme reaches the same fail-closed hostname validation used by analogous Web platform schemes, request and realtime wiring already provide the required hostnames, and the tests cover both acceptance and rejection. Important Files Changed
Reviews (1): Last reviewed commit: "feat: support capacitor:// as an allowed..." | Re-trigger Greptile |
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
What does this PR do?
Adds
capacitorto the schemes Appwrite recognises as web platforms, so origins such ascapacitor://app.tycko.czare accepted.Capacitor's iOS webview serves the app from
capacitor://<hostname>—capacitor://localhostby default, or the configuredserver.hostname. Appwrite did not know the scheme, soOriginskipped hostname matching and fell through to the custom-scheme allow list, wherecapacitoris absent. Every request from a Capacitor iOS app was rejected withInvalid Scheme. The scheme used (capacitor) ... is not supported.The origin is now matched by host against the project's registered Web platform hostnames, exactly like
tauri://and the browser-extension schemes.capacitor://app.tycko.czis accepted onceapp.tycko.czis registered as a Web platform, and nothing else is — an unregistered host still fails.Corsalready matched by host regardless of scheme, so it needed no change; a test pins that behaviour.Test Plan
vendor/bin/phpunit tests/unit/Network/CorsTest.php tests/unit/Network/Validators/OriginTest.php— 23 tests, 135 assertions, passing.Added coverage:
capacitor://localhostandcapacitor://appwrite.ioare valid against a matching allow list.capacitor://example.comis rejected, with theWeb (Capacitor)platform hint in the error.Cors::headers()echoescapacitor://app.example.comwhenapp.example.comis allowed.Related PRs and Issues
Reported by a customer using Capacitor with a custom
server.hostname(capacitor://app.tycko.cz).Have you read the Contributing Guidelines on issues?
Yes.
🤖 Generated with Claude Code