How to fix Chrome that redirects localhost to https

H

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 https://stackoverflow.com/questions/25277457/google-chrome-redirecting-localhost-to-https/28586593#28586593 with the following explanation:

  • I believe this is caused by HSTS – see http://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security
  • 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.

Add comment

Leave a Reply

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

Tag Cloud

Categories