Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: scheme is not respected on capacitor run with live-reload #7669

Open
1 of 3 tasks
matheo opened this issue Sep 23, 2024 · 6 comments
Open
1 of 3 tasks

[Bug]: scheme is not respected on capacitor run with live-reload #7669

matheo opened this issue Sep 23, 2024 · 6 comments

Comments

@matheo
Copy link

matheo commented Sep 23, 2024

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
  • 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 matheo added the triage label Sep 23, 2024
@TiBz0u
Copy link

TiBz0u commented Sep 24, 2024

@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

@jcesarmobile
Copy link
Member

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?

@jcesarmobile jcesarmobile added the needs reply needs reply from the user label Sep 24, 2024
@ionitron-bot ionitron-bot bot removed the triage label Sep 24, 2024
@matheo
Copy link
Author

matheo commented Sep 24, 2024

@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.

@Ionitron Ionitron removed the needs reply needs reply from the user label Sep 24, 2024
@jcesarmobile
Copy link
Member

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

@matheo
Copy link
Author

matheo commented Sep 25, 2024

@jcesarmobile oh I see
only Ionic has supported a custom url for live-reload
and Capacitor has never done that, my fault

@TiBz0u
Copy link

TiBz0u commented Sep 26, 2024

@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

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

No branches or pull requests

4 participants