title: localhost, 127.0.0.1 and hosts file are not working on a specific port
body: <p>I'm struggling with this problem for a while.</p>
  
  <p>When I enter <code>http://localhost:680/local</code> in chrome's address bar, the web page is loaded and everything works as expected. But when I enter anything else including <code>http://127.0.0.1:680/local</code> I get an error: <code>ERR_INVALID_HTTP_RESPONSE</code>.</p>
  
  <p>update: Today <code>localhost</code> stopped working as well.</p>
  
  <p><a href="https://i.stack.imgur.com/jdLLY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jdLLY.png" alt="enter image description here"></a></p>
  
  <p>My backend code isn't called and there is nothing received as I see in the DevTools:</p>
  
  <p><a href="https://i.stack.imgur.com/zUHS0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zUHS0.png" alt="enter image description here"></a></p>
  
  <p>This was working yesterday, and I don't know what has changed in my system.</p>
  
  <p><strong>If I change my port to 681 it works.</strong></p>
  
  <p>This is particularly important because I need to open the web page with URL prefix such as <code>admin.mysite.net:680/local</code> or <code>user.mysite.net:680/local</code> but adding these names to the <code>hosts</code> file doesn't do anything.</p>
  
  <h2>What I have tried:</h2>
  
  <h2>ping:</h2>
  
  <p>When I ping <code>127.0.0.1</code> it tells me the IPv6: <code>Reply from ::1: time&lt;1ms</code> and I've disabled IPv6 in registry but still it's showing <code>::1</code>:</p>
  
  <p><code>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\DisabledComponents = 0x20</code></p>
  
  <p>I can ping all names in hosts they all resolve to <code>127.0.0.1</code> and I can see them all in <code>ipconfig /displaydns</code></p>
  
  <h2>hosts:</h2>
  
  <p>I followed <a href="https://serverfault.com/a/452269/151294">these instructions</a></p>
  
  <p>I can edit <code>C:\Windows\System32\drivers\etc\hosts</code> but it doesn't make any difference. When I add or remove <code>127.0.0.1 localhost</code> or other value I always get the same result. I created a new single line ANSI file with this content <code>127.0.0.1 aaa</code> but <code>aaa:680/local</code> gives me the same error.</p>
  
  <h2>other:</h2>
  
  <p>I also tried <code>ipconfig /flushdns</code> and <code>ipconfig /registerdns</code>.</p>
  
  <p>I executed <code>netsh http add iplisten 127.0.0.1</code> and it added the IP address.</p>
  
  <p>I tried incognito and I cleared chrome data.</p>
  
  <p>I read that there was a bug with http-server so I tried <code>npm uninstall http-server</code> and 
  <code>npm install http-server@0.9.0</code>.</p>
  
  <p>I have no proxy, no automatic configuration script in LAN settings, no firewall.</p>
  
  <p>I'm out of ideas. What else can I try?</p>