Issue metadata
Sign in to add a comment
|
I cannot modify the HTTP response headers with Chrome extension on Windows Chrome
Reported by
jinlimi...@gmail.com,
Dec 12
|
||||||||||||||||||||||||||
Issue description
UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3638.0 Safari/537.36
Steps to reproduce the problem:
1. Load the extension.
2. Open a new tab.
3. Open the Developer tools.
4. Go to a website.
5. Check the Network Tab in the Developer tools.
What is the expected behavior?
Response headers of all requests should be modified.
What went wrong?
It can only successfully modify the response headers of part resources loaded in the website, but not work on the main HTML file request and other parts of requests.
Did this work before? N/A
Does this work in other browsers? N/A
Chrome version: 73.0.3638.0 Channel: canary
OS Version: 10.0
Flash Version:
I cannot modify the HTTP response headers with Chrome extension on Windows Chrome. This happens for a long time, the first time I found the problem is probably in version 63, I keep upgrade Chrome to the each newest version, but it doesn't help.
I tried some other extensions in the Chrome Store, also encountered the same issue.
The code looks like this:
```javascript
chrome.webRequest.onHeadersReceived.addListener(details => {
details.responseHeaders.push({ name: 'X-Test-Header', value: 'test' });
return { responseHeaders: details.responseHeaders };
}, {urls: ["<all_urls>"]}, ["responseHeaders", "blocking"]);
```
This code works fine on my Mac, but not on my Windows 10.
===
I found that my extension can successfully modify the response headers of part resources loaded in the website, but not work on the main HTML file request. so I think the problem was not in my code.
,
Dec 12
,
Dec 13
I tried to disable all extensions, even uninstalled them all, but I still got the same issue.
,
Dec 14
Tried testing the issue on chrome reported version# 73.0.3638.0 using Windows-10 with steps mentioned below: 1) Launched chrome reported version and installed extension from chrome://extensions 2) Opened New Tab Page > Devtools > Network tab and navigated to website(ex: fb.com) 3) Able to see requests generated in network tab(find attahced for the same) @Reporter: Please find the attached screencast for your reference and let us know if we missed anything in reproducing the issue. If possible provide the sample extension and screencast of the issue which help in better understanding and further triaging it in better way. Thanks!
,
Dec 14
Screencast file is too large, and I uploaded it to YouTube. Here is the private link: https://youtu.be/SHA-HBrlMmo
,
Dec 14
Thank you for providing more feedback. Adding the requester to the cc list. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Dec 28
@reporter: Could you please provide a sample extension file as requested in comment#4, which was used in screencast provided in comment#5 so that it would be really helpful in further triaging of the issue. Thanks.!
,
Dec 29
The sample extension file used in screencast provided in comment#5:
,
Dec 29
Thank you for providing more feedback. Adding the requester to the cc list. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Jan 2
Do you have the Network Service enabled? Does the problem reproduce if you disable it from chrome://flags/#network-service ?
,
Jan 3
The status of Network Service is the default. I found that when I upgrade to the latest Canary version, the issue seems like solved. I can successfully modify the value of Content-Type to 'text/plain' in the response headers, and it works, the web page displayed in plain text. But when I open the DevTools, turn to the network tab, the response header displayed in the list was still 'text/html'. I try to enable the Network Service in chrome://flags, the issue comes again, the modification of response header doesn't work. Only if I disable the Network Service, or keep it to default, the modification of response header works, but not shown in the network tab.
,
Jan 3
POC:
chrome.webRequest.onHeadersReceived.addListener(details => {
details.responseHeaders.find(x => x.name.toLowerCase() === 'content-type').value = 'text/plain';
return {
responseHeaders: details.responseHeaders,
};
}, {urls: ["<all_urls>"]}, ["responseHeaders", "blocking"]);
,
Jan 3
Thanks for confirming! Modifying the headers not working with Network Service enabled is Issue 827582 . For the solution see https://groups.google.com/a/chromium.org/forum/#!topic/chromium-extensions/vYIaeezZwfQ. (You need to add the "extraHeaders" option). |
|||||||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||||||
Comment 1 by woxxom@gmail.com
, Dec 12