Laurent Hinoul

“Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.” - John F. Woods

How to fix Chrome that redirects localhost to https

I was developing in angular and used url http://localhost:4200. Suddenly, Chrome gave me the following error: ERR_SSL_PROTOCOL_ERROR

SSL? When looking at the url, I saw that Chrome added https… When I changed it back to http, Chrome forces https again…

After some research, I found a solution on with the following explanation:

  • I believe this is caused by HSTS – see
  • If you have (developed) any other localhost sites which send a HSTS header…
  • eg. Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
  • …then depending on the value of max-age, future requests to localhost will be required to be served over HTTPS.

To fix this, got to this url: chrome://net-internals/#hsts

Scroll all the way down to Delete domain security policies. Then, type localhost in the input field and press delete.

After that, localhost should be accessible again under http.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: