HTTPS enabling without Annoying message

Hello. I try to use https for a simple web app i create locally…

I set httpsEnabled flag to ‘True’ in build.gradle file… but when I open the project in Chrome, the classic message that connection is not safe occurs… How can I bypass this?

Is there any way to create a self-signed certificate? The answer is yes, and I try to create one… but how can i import this certificate to the gradle project ? So that I ‘fool’ the browser to think the app is safe…?

Thank you!

Hey Panagiotis,

this question is very vague as you did not explain exactly what you are trying to do. But even without the details there is no way to avoid that even with a self-signed certificate. The browser is where you need to have the certificate imported into. You cannot control the browser from gradle so there is no solution.

Certificate trust starts from the browser trusting your application and that happens by importing the certificate into the browser’s trust store (which can vary from browser to browser and even between operating systems)

It seems likely that you are using Gretty based on your description.

Gretty automatically creates the self-signed certificate for you on first run (see Gretty HTTPS Auto-configuration). You see the “classic message that connection is not safe” because the certificate is self-signed, not because it’s missing (it’s absolutely required for the HTTPS connection).

If you would rather create your own self-signed certificate that can’t get removed from the build directory accidentally, follow the instructions in Gretty HTTPS Manual configuration.

Either way, the certificate that you end up using needs to be imported into the browser trust store as mentioned by @Alex_Vol.