How to resolve chrome ssl localhost error when using docker?

I recently encountered a problem when trying to load a local dev site that was served using a docker container.

The error I encountered was classified as a privacy error.

” Your connection is not private Attackers might be trying to steal your information from 127.0.0.1 (for example, passwords, messages or credit cards). NET::ERR_CERT_INVALID “

chrome connection not private

Further information on this error was contained in the advanced section which showed the following information.

” Advanced 127.0.0.1 normally uses encryption to protect your information. When Google Chrome tried to connect to 127.0.0.1 this time, the website sent back unusual and incorrect credentials. This may happen when an attacker is trying to pretend to be 127.0.0.1, or a Wi-Fi sign-in screen has interrupted the connection. Your information is still secure because Google Chrome stopped the connection before any data was exchanged.

You cannot visit 127.0.0.1 at the moment because the website sent scrambled credentials that Google Chrome cannot process. Network errors and attacks are usually temporary, so this page will probably work later. “

chrome connection not private advanced

Solution

The solution that worked for me was to allow insecure local host.

Go to the url in your chrome browser

chrome://flags/#allow-insecure-localhost

You want to enable this option and restart the browser.

” Allow invalid certificates for resources loaded from localhost. Allows requests to localhost over HTTPS even when an invalid certificate is presented. – Mac, Windows, Linux, Chrome OS, Android #allow-insecure-localhost

chrome allow 1
chrome allow 2
chrome allow 3

Once this option is Enable an option will pop up at the bottom of the screen for you to Relaunch and “Your changes will take effect the next time you relaunch Google Chrome.”

chrome relaunch browser

As I was the developer working on the localhost (127.0.0.1) site, I knew about the potential secure concerns.