To make this work, I need to add the code from user Badisi in this github issue to MainActivity.java. Otherwise, the self signed certificate is not accepted.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {{
// Additional plugins you've installed go here
// Ex: add(TotallyAwesomePlugin.class);
}});
if (BuildConfig.DEBUG) {
this.bridge.getWebView().setWebViewClient(new BridgeWebViewClient(this.bridge) {
@Override
public void onReceivedSslError(WebView view, final SslErrorHandler handler, SslError error) {
handler.proceed();
}
});
}
}
This works, but it skips Capacitor 3 plugin auto detection.
How can I modify this code to have working Capacitor 3 plugin auto detection?
Do you plan to implement support for --ssl flag in livereload mode? Would be great. In some cases, it is needed.
Great, thank you! Still an ugly solution, but much better than hacking files in the node_modules folder - At least you see it in git changelog of package.json
Finally found a good solution for that. After struggling with self signed certficates I found ngrok. With ngrok you can proxy your localhost with a public ssl encrypted domain.
Just install ngrok with apt-get or brew, and start a tunnel with a command like ngrok http localhost:8100. You then get a public domain which you can use for livereload like ionic cap run android --livereload-url https://mysubdomain.ngrok.dev.
ngrok generates a random domain in the free version. You can subscribe from 10$/Month to use your own domain.
It`s a great tool! Finally livereload with Auth0 in my project.
@admins1 : I think this solution should be add to those github tickets:
I can imagine that a lot of people who need https in their Ionic / Capacitor app struggle with that.