电容器 - 为 cors 设置原点

Capacitor - Set origin for cors

是否可以在 Android Capacitor 应用程序上设置默认原点 https://example.org 而不是标准 http://localhost

来源由 webview 处理,取决于 url 提供应用程序的位置,因此您不能直接更改来源,但可以更改 url 电容器的使用,这将改变原点。要更改 url,请在 capacitor.config.json

中配置服务器对象的主机名和 androidSchene 属性
"server": {
    "hostname": "example.org",
    "androidScheme": "https"
}

https://capacitor.ionicframework.com/docs/basics/configuring-your-app#common-configuration