Localhost not working in Chrome, 127.0.0.1 does work Localhost not working in Chrome, 127.0.0.1 does work google-chrome google-chrome

Localhost not working in Chrome, 127.0.0.1 does work


Here are the steps I took to make this work correctly:

  1. Edited my hosts file so 127.0.0.1 localhost. was present, and saved the file
  2. Cleared my Chrome cache, specifically cookies and cached files
  3. Cleared host cache in chrome://net-internals/#dns
  4. Restarted chrome

Alternatively, this also works:

  1. Navigate to chrome://net-internals/#hsts
  2. Under "Delete domain", type localhost and delete

Unbeknownst to me, my project had an HSTS middleware that set an HSTS cookie


For me (I had HTTP and HTTPs dev server on same port)

  • Chrome Dev tools F12
  • Application tab
  • Clear storage sub-tab
  • "Clear site data" button


I solved my problem by:

  • opening the developer console F12
  • Going to network tab
  • Check Disable Cache
  • Browse locahost