Modifying responseHeaders in Web Extension using onHeadersReceived appears to break pages

Duplicate Issue #10246681 • See Issue #8796739

Details

Author
Petro ..
Created
Dec 16, 2016
Privacy
This issue is public.
Found in
  • Microsoft Edge
Duplicates
See progress on Bug #8796739
Found in build #
14.14393
Reports
Reported by 2 people

Sign in to watch or report this issue.

Steps to reproduce

Perhaps I am doing something wrong, but this code works in FF and Chrome so…gonna file a bug.

Here’s the code in question:

const HEADERS_TO_STRIP_LOWERCASE = [
  'content-security-policy',
  'x-frame-options',
];

chrome.webRequest.onHeadersReceived.addListener(
  details=>({responseHeaders:details.responseHeaders.filter(header => HEADERS_TO_STRIP_LOWERCASE.indexOf(header.name.toLowerCase()) < 0)}),
  {urls: ["*://*.netflix.com/*"]},
  ["blocking", "responseHeaders"]
)

The intended functionality is to modify the headers from Netflix.com in order to remove the I-Frame options.

What happens is when this extension is active, I cannot access Netflix as a webpage at all. If I navigate to Netflix then the browser tries to download the page instead of display it. Attached is an example screenshot.

Thanks

PS: Props on your work on this browser it feels great to use and develop on

Attachments

1 attachment

Comments and activity

  • Microsoft Edge Team

    Changed Assigned To to “Sebastian P.”

    Changed Status to “Duplicate”

  • We are seeing a similar error. Modifying the content-type header causes the request to fail (webRequest.onErrorOccurred is triggered) and Edge offers to download the file. This is not the behavior of Chrome.

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

Sign in