How to estabilish a secure connection on localhost with angular dart webdev?

Issue

I’m using angular dart to build a web application, and when it comes to accessing user location feature such as geolocation, browsers like chrome enforce https.
When I deploy the web application the location api works because the connection is secure, but when I debug on localhost it is broken because (I assume) of the unsecure session.

Is there a way to configure the webdev generated http server to use somehow a self signed ssl certificate?

Is there any viable alternative?

Solution

Yes, --tls-cert-chain and --tls-cert-key flags were just added to webdev serve. I used this tutorial for setting up the cert and key: https://www.freecodecamp.org/news/how-to-get-https-working-on-your-local-development-environment-in-5-minutes-7af615770eec/.

Then the following command served up the app at https://127.0.0.1:8080

webdev serve --release --tls-cert-chain path-to-cert/server.crt --tls-cert-key path-to-key/server.key

The changes are in webdev 2.5.0.

Answered By – rkunboxed

Answer Checked By – Marie Seifert (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *