MS Edge - disable auto HTTPS for localhost
edge browser security

How to disable automatic redirect to HTTPS for localhost.
May 17, 2023

I noticed recently that logging into various CLI tools (Azure DevOps CLI, GitHub, etc.) wasn't working for me - browser window opened, I signed in, gave permissions, and ended with an invalid request on https://localhost.......

What happens is a normal browser OAuth flow, which opens redirect to localhost with authorization code when done. The problem was that my Microsoft Edge started forcing HTTPS. Even when I manually changed the URL in the address bar to http://localhost..... it still changed it.

Solution? Remove HSTS security policy in the browser.

  1. Go to edge://net-internals/#hsts
  2. In the Delete domain security policies section type localhost as the Domain.
  3. Click Delete.

Now http://localhost should work again.

Found something inaccurate or plain wrong? Was this content helpful to you? Let me know!