Edge extensions don't work with XMLHttpRequest to localhost

Confirmed Issue #13966307 • Assigned to Mahesh J.

Details

Author
Ken M.
Created
Sep 27, 2017
Privacy
This issue is public.
Found in
  • Microsoft Edge
Reports
Reported by 5 people

Sign in to watch or report this issue.

Steps to reproduce

Edge extensions (unlike Chrome, Safari and Firefox) don’t properly handle XMLHttpRequest calls to localhost in a background script.

To reproduce:

  1. Run a web server on localhost (127.0.0.1 on port 8000) (an easy way to do this with python 3 is: python -m http.server 8000
  2. Load the attached extension in Edge
  3. Open the background script for debugging
  4. Go to https://developer.microsoft.com/en-us/windows/bridges/hosted-web-apps and hit refresh if necessary (this just kicks off the content script and gets things going)
  5. In the background debugger, you would expect to see these console messages:
    UNSENT 0
    OPENED 0
    LOADING 200
    DONE 200
  6. Note that instead only UNSENT and OPENED messages are seen and status doesn’t change from 0
  7. To see the script working with a non-localhost address, comment out this line in the background-script.js file:
    var url = 'http://127.0.0.1:8000';
    and uncomment the line before:
    //var url = 'https://developer.mozilla.org:443';
  8. Reload the extension and refresh the page and everything works as expected (for the non-localhost page)

Attachments

1 attachment

Comments and activity

  • Microsoft Edge Team

    Changed Assigned To to “Steven K.”

    Changed Assigned To to “Akshay P.”

    Changed Status to “Confirmed”

    Changed Assigned To from “Akshay P.” to “Mahesh J.”

  • I ran into this issue while developing my own extension, and it was frustrating to say the least. It turns out that you need to ensure that edge is added to the loopback exempt list with the command "CheckNetIsolation LoopbackExempt -a -n="Microsoft.MicrosoftEdge_8wekyb3d8bbwe", documented here - https://developer.microsoft.com/en-us/microsoft-edge/platform/faq/#how-can-i-debug-localhost. To remove it from the exempt list (for security reasons), use the command CheckNetIsolation LoopbackExempt -d -n="Microsoft.MicrosoftEdge_8wekyb3d8bbwe".

    A recommendation for this issue is to add Edge to the exemption list once the developer has selected “Enable extension developer features…” in about:flags.

  • Small note, is that those commands, CheckNetIsolation LoopbackExempt -a -n="Microsoft.MicrosoftEdge_8wekyb3d8bbwe and CheckNetIsolation LoopbackExempt -d -n="Microsoft.MicrosoftEdge_8wekyb3d8bbwe, should be run in a Powershell prompt in Administrator mode.

You need to sign in to your Microsoft account to add a comment.

Sign in