Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does Microsoft Edge open some local websites, but not others, where the domain name is routed to 127.0.0.1 in hosts file

Like a lot of programmers, I test sites locally.
I use the hosts file to map domain names to my local ip (127.0.0.1).

I use qualified domain names, usually with a "d" subdomain (for "development").

For example:

d.somewebsite.com  d.anotherwebsite.com  and so on... 

In Microsoft edge, most of the web sites work. However, a couple of them do not. There is nothing special or weird about the domain names that won't work. Just a simple d.someletters.com.

They work fine in Chrome, IE, and Firefox.

In Edge, I get the error message: "Hmm, we can't reach this page."

At first I thought it wasn't resolving the IP. However, I realized when I made a typo on another non-related url, that requests which are not routed by the hosts file are sent to my ISP to be resolved. If my ISP can't resolve it, they send back this special search results page with suggestions of what you might be trying to find. Well, when I go to my local domain, I do not get this page from my ISP. I get the error mentioned above straight from edge.

So, it seems to me that Edge is resolving the domain correctly, otherwise it would have been sent off to my ISP's DNS.

So, I would think then that maybe Edge just can't connect to the local machine. But like I said, several of these local domains are working fine. Also, using 127.0.0.1 directly in Edge also works. It's just these couple of domain names giving me a problem. And only in Edge (all other browsers work) Any ideas?

The web server is Apache2 for Windows (xampp) if that matters.

Also, if I open the debug window in Edge and monitor the network, I do not see any requests going out at all.

EDIT: I am no longer using the hosts file. I have dnsmasq running on one of my Linux boxes and I am using it for DNS instead of hosts. Also no longer using loopback (obviously since DNS is on another box now), I am using an internal private ip address (192.168...). Same issue.

like image 953
Evan de la Cruz Avatar asked Sep 03 '15 20:09

Evan de la Cruz


2 Answers

  • Your network can block loopback as a security measure in Windows 10.

  • Open a command prompt as administrator, and run this to exempt Edge from a loopback:

    CheckNetIsolation LoopbackExempt -a -n="Microsoft.MicrosoftEdge_8wekyb3d8bbwe" 

(Microsoft.MicrosoftEdge_8wekyb3d8bbwe is the identifier for the Edge app)

There's a blog post here giving more detail: https://blogs.msdn.microsoft.com/msgulfcommunity/2015/07/01/how-to-debug-localhost-on-microsoft-edge/

like image 108
Chris Halcrow Avatar answered Sep 22 '22 08:09

Chris Halcrow


I (thought I) solved it!

Things that did not work:

  • Making changes to IE compatibility settings or Windows compatibility lists
  • Using fully qualified domain names
  • Using an IP address other than loopback
  • using http vs https
  • remove all javascript and cross-site scripts/resources from the web page
  • checking / unchecking the option in about:flags for allowing localhost loopback or using compatibility settings
  • removing / adding / editing the entries in the TabProcConfig of the Windows Registry
  • deleting browsing history, cache, cookies

The Solution: in a complete counter-intuitive twist:

Remove the domain names from your trusted sites list!

  1. Open the Internet Options dialog (just ask Cortana or use windowskey+s)
  2. Go to the Security tab
  3. Click on the Trusted Sites zone
  4. Click the Sites button
  5. Remove the troubled domain names from the trusted sites list
  6. Click Apply and then close the dialog
  7. Open Edge (or restart it if it is already running)
  8. Viola

I should note that I, using common-sense, figured that it wasn't just the fact that the site was merely present in the "Trusted Sites" zone that caused the issue. I figured it was some setting on that zone. So, before I deleted the domain names from the "sites" list, I made all of the settings match my Internet Zone settings exactly (Medium high security, enable protected mode, do not require server verification for all sites), and I also tried every other combination I could find. There was no combination of zone security settings that worked. The only solution was to simply remove the domains from the Trusted Sites list completely. Funny thing is that it works in IE regardless, even though this is the internet settings dialog for IE. This only seems to affect Edge.

Windows 10 Internet Options

Remove Trusted Sites from the Trusted Zone

EDIT: Two weeks later I change my configuration to, instead of the hosts file, use dnsmasq on a local Linux machine and using it for DNS. I'm not sure if it happened right away but at some point Edge stopped working again! I already had the "allow loopback" checkbox checked in about:flags, so I didn't expect the CheckNetIsolation fix to work. But, it did. Edge version is 20.10240.16384.0. I used the fix from Can't open localhost in Microsoft Edge (Project Spartan) in Windows 10 preview

EDIT #2 A couple of months later and Edge is having this problem again. I tried both previous solutions (and others) and neither of them work for me anymore. I'm leaving this answer because I am assuming I experienced two separate problems.

like image 30
Evan de la Cruz Avatar answered Sep 20 '22 08:09

Evan de la Cruz