-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
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/ios: not installed
@capacitor/cli: 6.1.2
@capacitor/core: 6.1.2
@capacitor/android: 6.1.2
[success] Android looking great! 👌Other API Details
npm --version
10.9.0
node --version
v22.11.0Platforms Affected
- iOS
- Android
- Web
Current Behavior
Despite setting an HTTPS URL in capacitor.config.ts, when ionic capacitor run android --livereload --external is run, the app loads the HTTP version of the URL.
import type { CapacitorConfig } from '@capacitor/cli';
const config: CapacitorConfig = {
appId: 'io.ionic.starter',
appName: 'LivSports',
webDir: 'dist',
server: {
androidScheme: "https",
url: "https://192.168.1.5:8100",
}
};
export default config;Upon inspecting the generated android\app\src\main\assets\capacitor.config.json file, it also shows that is it has removed the HTTPS from the URL and is using the HTTP instead.
{
"appId": "io.ionic.starter",
"appName": "LivSports",
"webDir": "dist",
"server": {
"androidScheme": "https",
"url": "http://192.168.1.5:8100"
}
}However, once the dev server exits this file changes the URL to https:// again.
It seems http is being hardcoded here:
capacitor/cli/src/util/livereload.ts
Line 164 in e4b0540
| const url = `http://${options.host}:${options.port}`; |
Expected Behavior
Ionic should use the server URL set in the config AS-IS. Stripping the protocol and using http by default defeats the purpose of setting an custom server URL entirely.
Project Reproduction
https://github.com/ionic-team/starters
Additional Information
My dev server is properly configured to use SSL, I generated the certificates and keys and added everything to the trust root and the live-server URL is accessible without any warnings in my phone via Chrome.