You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
content: Android Capacitor origin is https://localhost by default, not http://localhost #4546
The CORS docs state that the Android origin is http://localhost. On current Capacitor this is https://localhost by default, because server.androidScheme defaults to https. The current wording leads people to whitelist the wrong origin and get blocked requests on Android.
What the docs say
From the CORS page:
An origin is the combination of the protocol, domain, and port from which your Ionic app or the external resource is served. For example, apps running in Capacitor have capacitor://localhost (iOS) or http://localhost (Android) as their origin.
What actually happens
On a default Capacitor app (no androidScheme set), the Android webview origin is https://localhost, not http://localhost.
Tested on Capacitor 7 with a production backend. The server logged the incoming Origin header per platform:
Apps running in Capacitor have capacitor://localhost (iOS) or https://localhost (Android) as their origin by default. The Android scheme follows server.androidScheme, which defaults to https. It is http://localhost only if you set androidScheme: 'http'.
If this looks right, I am happy to open a PR with the change.
Activity