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]: Hardcoded HTTP protocol for LiveReload prevents using HTTPS #7745

Open
1 of 3 tasks
MirazMac opened this issue Nov 1, 2024 · 0 comments
Open
1 of 3 tasks

[Bug]: Hardcoded HTTP protocol for LiveReload prevents using HTTPS #7745

MirazMac opened this issue Nov 1, 2024 · 0 comments
Labels

Comments

@MirazMac
Copy link

MirazMac commented Nov 1, 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/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.0

Platforms 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:

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.

@MirazMac MirazMac added the triage label Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant