capacitor
capacitor copied to clipboard
[Bug]: scheme is not respected on capacitor run with live-reload
Capacitor Version
💊 Capacitor Doctor 💊
Latest Dependencies:
@capacitor/cli: 6.1.2 @capacitor/core: 6.1.2 @capacitor/android: 6.1.2 @capacitor/ios: 6.1.2
Installed Dependencies:
@capacitor/android: 6.1.2 @capacitor/core: 6.1.2 @capacitor/cli: 6.1.2 @capacitor/ios: 6.1.2
Other API Details
npm 10.5.0
node v18.20.2
Platforms Affected
- [ ] iOS
- [X] Android
- [ ] Web
Current Behavior
It was reported here that live-reload has a hardcoded scheme and it still seems to be the case on main:
https://github.com/ionic-team/capacitor/blob/main/cli/src/util/livereload.ts#L172
Why does the API of this command exposes --scheme if we cannot connect to a localhost served with --ssl?
https://capacitorjs.com/docs/cli/commands/run
Expected Behavior
To be able to run ng serve --ssl and connect to it via --live-reload --scheme=https.
Project Reproduction
https://github.com/matheo/capacitor-live-reload-bug
Additional Information
No response
@matheo The exposed scheme in the "run" command correspond to the iOS schemes. It's not linked to the https protocol.
Are you sure you cannot use attribute --port=443 for HTTPS ?
--live-reload --port 443
What TiBz0u commented is correct, --scheme is the iOS project scheme, not the live reload url scheme.
The provided app doesn't run using https, so it's not valid to reproduce. Can you provide one that runs the live reload server on https?
@TiBz0u @jcesarmobile so it's impossible to modify the --live-reload-url as it was before, and the capacitor.config will always be updated with an http:// url unable to consume a secure API locally?
I tried to serve --port 443 but that port is already in use, you get a Error: listen EACCES: permission denied 0.0.0.0:443. My point is: live-reload patches the server.url config and it needs to be https for the App to query secure development APIs.
Capacitor has never supported --live-reload-url, not sure what you are talking about.
You can always edit the capacitor config file manually and edit the sever.url to point to a https url, but don't use the --live-reload option as it will replace whatever you have in the config file
@jcesarmobile oh I see only Ionic has supported a custom url for live-reload and Capacitor has never done that, my fault
@matheo, wondering if it --host <host> does respond to your use case if you want to use only the cli command?
@jcesarmobile can you confirm?
Thanks
closing in favor of https://github.com/ionic-team/capacitor/issues/8049 since it's a feature request and not a bug
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.