Microsoft Edge won't load local nginx website

2019-06-28 04:06发布

问题:

I'm experiencing a strange issue with Microsoft Edge not loading a local Craft CMS website hosted inside a vagrant virtual machine. Any attempt to load the locally configured host name or IP, returns the "Hmm, we can't reach this page." error.

I have a line in my hosts file:

192.168.10.12 test.craft.dev

I've read various resources about Microsoft Edge not properly handling the hosts file properly, however not even the IPv4 address works either. I've tried several of the recommendations related to Internet Options tweaks but nothing works, it does seem however the hosts file is not the issue.

The network configuration uses NAT and sets an IP in the range of 192.168.10.x (defined by Homestead.yaml, if I assign a public_network and get an IP with my LAN network DHCP range, Edge can access this IP, but it doesn't explain why all other browsers work and Edge doesn't without it.

It's worth mentioning that the local Craft hostname will load fine in every other browser (including IE). Does Microsoft Edge have specific issues with loading local websites inside VirtualBox due to some network level issue?

回答1:

Install and run fiddler. It will do everything automatically.



回答2:

It seems you are using Laravel Homestead box. If so, you can forward one of your host ports to the 80 port of your VM. Thus, you will be able to access your web sites hosted on your VM on MS Edge.

Here is what I've done:

ports:
    - send: 8000
      to: 80

If you don't want to have to type yourdomain.dev:8000 you may use fiddler. Thus, you will be able to only type yourdain.dev. :D



回答3:

Edge browser seems to pay attention to the interface you are using to access your sites. My guess is that you are using Vagrant to launch a Virtualbox VM. My answer below assumes that you are accessing via a Virtualbox host-only network, or some other network interface that has an NdisDeviceType of 1.

What didn't work

None of the following worked for me:

  1. Using about:flags and confirming that "allow localhost loopback" was on

  2. Control panel, Network and Internet, Internet Options, Security and adding my site explicitly to Trusted Sites or Local Internet.

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

My environment

In my case, I have VirtualBox 5.2.18 running on Windows 10 build 1803 "Spring Creators Update". Using Edge 42.17134.1.0. I have a host-only network for my VM guests. e.g. 192.168.7.0/24. I couldn't access addresses from my Edge on the VM host such as http://192.168.7.0. This site was hosted by a web server running in my VM guest. Note that this address worked just fine in Google Chrome, Internet Explorer 11 etc.

What worked

The solution is as follows:

  1. Find the interface number for the host only network. I ran "route print" from the Windows command line and the first number shown in the "interface list" in my case was 17.

  2. Use regedit to change the interface type from 1 to 0. The key is:

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class{4d36e972-e325-11ce-bfc1-08002be10318}\XXXX

In my case XXXX was 0016 because my interface number was 17. I had to change *NdisDeviceType from 0 to 1. The * in that key name is a literal asterisk. I had to reboot for the changes to take effect.

The answer was gleaned from a post by "Jani L" dated Oct 3, 2017, on the first URL referenced below, but it didn't give a clue as to how to determine the interface number. The second reference below was the thread on which I originally posted this solution.

References:

https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/10142843/

https://social.technet.microsoft.com/Forums/en-US/0face535-3c7a-4658-be34-6c376322ca34/microsoft-edge-cant-open-local-domains

https://www.virtualbox.org/ticket/15565