64

I installed Windows 10 preview and installed IIS.

Open "http://localhost" in Project Spartan can't connect.

IE has no problem. What's the problem?

TylerH
  • 19,065
  • 49
  • 65
  • 86
sayingu
  • 1,921
  • 3
  • 16
  • 24
  • 2
    This might be a quirk with Spartan, seeing as it is not in a final release form. Does running `CheckNetIsolation LoopbackExempt -a -n=Microsoft.Windows.Spartan_cw5n1h2txyewy` from an elevated command prompt resolve the issue? – vcsjones May 19 '15 at 19:19
  • As of build 10166, [localhost is now accessible by default in Microsoft Edge](https://twitter.com/jonathansampson/status/619193524991492097). – Sampson Jul 09 '15 at 17:31
  • I had the same problem when trying to open http: //my-fqdn (where my-fqdn is the fully qualified domain name of my laptop). Oddly enough, http: //localhost worked fine. The accepted answer below fixed my problem, though I had to use the command-line fix. Just checking the box in about:flags did *not* fix the problem for me. (It was already checked. Unchecking, restarting, rechecking, restarting also did *not* work.) – Matt Varblow May 25 '17 at 14:57
  • Voting to close as No-repro as this is no longer reproducible and people for some reason are still coming here for solutions to their problems with newer versions of Windows 10. – TylerH Dec 15 '17 at 16:32

8 Answers8

78

So the issue is Spartan Edge doesn't have access to the loopback addresses, which is something that most Windows Store apps are blocked from accessing.

If you are using Windows 10 RTM or build 10166, this can be done by navigating to about:flags and checking "Allow localhost loopback":

enter image description here

Image courtesy of Ryan Joy and used with consent.

If you are using a previous build of Windows 10, the CheckNetIsolation tool can be used to add it to the LoopbackExempt list. Use this from an elevated command prompt:

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

Microsoft.MicrosoftEdge_8wekyb3d8bbwe is the identifier for the Edge app. It can be determined by using Get-AppxPackage in PowerShell and sifting through the results for the Spartan / Edge and using the PackageFamilyName.

As of Build 10158, the PackageFamilyName has changed from Microsoft.Windows.Spartan_cw5n1h2txyewy to Microsoft.MicrosoftEdge_8wekyb3d8bbwe.

vcsjones
  • 128,004
  • 28
  • 283
  • 274
  • I suspect this workaround will not be required once Spartan actually ships. – vcsjones May 19 '15 at 19:23
  • 16
    I work on the Microsoft Edge team. This is a *known issue* that we are currently looking into. – Sampson Jun 09 '15 at 07:21
  • 2
    Jonathan, does that mean Edge *should* have localhost access eventually? And would that localhost access work from any web page or just manually in the address bar? – nemec Jun 12 '15 at 17:37
  • Check also this thread: http://answers.microsoft.com/en-us/insider/forum/insider_internet-insider_spartan/spartan-will-not-view-localhost-sites/92a0a2f0-f1ba-4ab9-a486-7fe1fa1f5b97 – Mikhail Jun 24 '15 at 19:07
  • I am using the latest build which is 10240, try both CheckNetIsolation command but no different & I still can't access into localhost, it might be good if those who are able to connect to their localhost posting here with some screenshot – mutanic Aug 07 '15 at 03:59
  • 35
    When I went into the developer settings, the "Allow localhost loopback" was already checked, and it still is not working. – Metropolis Aug 21 '15 at 16:42
  • 2
    Rather than 'sifting through' the PowerShell responses you can filter like so: `Get-AppxPackage | ? { $_.PackageFullName -like '*edge*' }` – Richard Hauer Sep 07 '15 at 01:51
  • 1
    None of these solutions worked for me. The solution for me was to remove the domain name from the Trusted Sites list. http://stackoverflow.com/questions/32384571/why-does-microsoft-edge-open-some-local-websites-but-not-others-where-the-doma – Evan de la Cruz Oct 10 '15 at 08:07
  • @Sampson XAMPP localhost malfunctions on Edge precisely because it insists on prefixing the named site with `localhost`, e.g. `localhost/mysite/`, not just `mysite/`, which is the way localhost sites are accessed on every other browser. For example, I have an htaccess MOD rewrite that directs `info` to `/info.php`. Because of the `localhost/` prefix requirement, the site looks for `info.php` not in `mysite` but in the root, `localhost`, causing the site to fail. This does not happen when the site is run from as live server. What can be done to eliminate the requirement for the prefix? – Tom Oct 18 '15 at 07:19
  • @Tom I'll setup a small XAMPP project on my end to see if I can repro the issue. Can you share an example of your .htaccess file so as to ensure parity between my setup and yours? – Sampson Oct 19 '15 at 16:35
  • @Sampson Please see my new entry to this thread below, as it contains detailed information on how my XAMPP server is set up. The .htaccess code in question, though, is: Options +FollowSymLinks RewriteEngine on RewriteRule ^info/?$ /info.php [L] -- This is easier to read in my response post at the bottom, because of the formatting it allows. Thanks for your help! – Tom Oct 20 '15 at 19:37
  • @Tom using answers to ask for clarification is likely to get your "answer" deleted. I would instead ask a new StackOverflow question all together with that text and link Jonathan to it. – vcsjones Oct 20 '15 at 22:35
  • @Sampson I had posted a full description of my set-up and a way to reproduce the issue on edge as a fresh response here, but one of the readers advised me to move it elsewhere. I had already started a thread on that, and so I moved my explanation there, which is here:https://stackoverflow.com/questions/33193796/running-localhost-in-edge-browser-creates-path-confusion – Tom Oct 21 '15 at 02:38
  • I had "Allow Loopback" unchecked and this command still fixed my issue. – Kevin Ghadyani Apr 18 '16 at 21:48
  • 5
    I unchecked the allow loopback option, restarted edge, then checked it, restarted edge again, and it worked. – bzuillsmith Apr 25 '16 at 23:03
  • 3
    @Sampson, Its almost 2018 and it still does not work. – Pedro Silva Dec 06 '17 at 15:26
  • 3
    @Sampson *I work on the Microsoft Edge team. This is a known issue that we are currently looking into. – Sampson Jun 9 '15* Aaand 3 years later and it STILL does not work. – Stijn de Witt May 29 '18 at 07:24
  • 5
    @Sampson, It's 2019 and it still doesn't work - what a progress huh. – Oscar Jara Apr 15 '19 at 19:33
  • 2
    @Sampson now 2020, still cannot loopback in Edge – afarley Jan 27 '20 at 19:28
  • When I enter localhost address to EDGE it opens me IE with that address, what now ? :/ – Muflix Mar 26 '20 at 14:00
18

Microsoft Edge runs with network isolation by default for security reasons. To enable loopback and debug your localhost server run the following command from an elevated shell if you have 10158 or newer:

CheckNetIsolation LoopbackExempt -a -n=Microsoft.MicrosoftEdge_8wekyb3d8bbwe

or

checknetisolation loopbackexempt -a -p=S-1-15-2-3624051433-2125758914-1423191267-1740899205-1073925389-3782572162-737981194

or this one if you have an older version

CheckNetIsolation LoopbackExempt -a -n=Microsoft.Windows.Spartan_cw5n1h2txyewy

In a future update, you’ll be able to enable localhost loopback support using about:flags.

Doris Chen
  • 702
  • 3
  • 13
  • 3
    For anyone who is not familiar with command. Open command prompt such as **cmd** or **PowerShell** or whatever command line program for Windows and open it as administrator by right click. Enter the command from the answer above and press enter. Close all MS Edge window and re-open it. That's it. – vee Aug 17 '16 at 09:01
  • Tried both coms as admin. Dev flag is also checked. Does not work. Pop up "You'll need an app..". Any ideas? – Tadas V. Feb 09 '17 at 10:36
  • 2
    So wait, I can access the whole internet, but not the local host, 'for security reasons'? Seems to make no sense.... I am a developer. Accessing localhost is kinda... you know... **important**. As it does not work I just don't test on Edge. I wonder how this will work out for Edge, the browser. My guess is the inability to test with it will mean it will get little love from devs. I know I'm not going through another 'just install VMs to test your website' IE shenanigans again! – Stijn de Witt May 29 '18 at 07:28
  • 1
    Ran into this issue on Win10 pro build 18363. So it's still a thing. Dev flags were checked. Solved it with the first command. – Pantalaimon Dec 03 '19 at 13:19
8

For the latest build (10158), the following command did it for me:

CheckNetIsolation LoopbackExempt -a -n=Microsoft.MicrosoftEdge_8wekyb3d8bbwe

The trick is to use the Get-AppxPackage PowerShell command to find out the family name of Edge app as vcsjones mentioned.

Community
  • 1
  • 1
Usman
  • 2,496
  • 1
  • 16
  • 14
  • I have to do `CheckNetIsolation LoopbackExempt -a -n="Microsoft.MicrosoftEdge_8wekyb3d8bbwe"` - note the quote marks around the family name – Laurence Dec 22 '17 at 01:50
7

As of Windows 10 Build 10166+ (available today via Windows Insider), localhost access is available by default in Microsoft Edge without running the CheckNetIsolation command listed in previous answers.

You can disable this access via "about:flags", if you wish to have an even more secure configuration.

Charles Morris - MSFT
  • 1,883
  • 1
  • 11
  • 12
  • 2
    I can use 'localhost' and the official ip address on a build 10240, but unfortunately, the computer name can not be used. – Simon Sep 02 '15 at 06:48
  • It also can't access subdomains of localhost - I have each of my web projects configured as `project1.localhost:8080`, `project2.localhost:8080` etc. since I can use root relative URLs - however Edge cannot access them – Brendan Apr 25 '16 at 22:56
  • Actually, when I access localhost, it works once. Then when I try to reload the page it comes up with the 'you need an app for that' message again. So testing with Edge is really inconvenient! – Stijn de Witt May 29 '18 at 07:30
1

Please follow to following steps:

1.

enter image description here

2.

Copy this code

CheckNetIsolation LoopbackExempt -a -n=Microsoft.MicrosoftEdge_8wekyb3d8bbwe

3.

enter image description here

**

Job Done!

Vinod Kumar
  • 737
  • 7
  • 8
0

Add subdomain to C:\Windows\System32\drivers\etc\hosts (Windows 10)

Prosky
  • 1
0

Navigate to C:\Windows\System32\drivers\etc save hosts file copy for backup open hosts file as administrator delete or comment out any lines with 127.x.x.x or localhost...

restart pc.

Ali Mustafa
  • 115
  • 4
0

Neither did the CheckNetIsolation LoopbackExempt -a -n=Microsoft.MicrosoftEdge_8wekyb3d8bbwe command nor manually enabling the "Allow localhost loopback" on Edge work for me.

What did work is the following:

  1. Edit the C:\Windows\System32\drivers\etc\hosts file and add a mapping for a custom hostname to 127.0.0.1 like 127.0.0.1 local.

  2. Open Internet Options and add http://local to the local intranet sites.

d.i.joe
  • 160
  • 4
  • 17