如何hacke浏览器HTTP request的header
1,参考文章:http://stackoverflow.com/questions/7097502/view-and-set-http-headers-for-safari-chrome
(1)这个是chrome上的方案
The (currently experimental) WebRequest API lets you do view and modify headers: http://code.google.com/chrome/extensions/trunk/webRequest.html
It's pretty easy to view headers using onSendHeaders
.
To edit headers, you'll need to block the request. This sample (from the docs linked to above) removes the User-Agent header from all requests:
chrome.experimental.webRequest.onBeforeSendHeaders.addListener(
function(details) {
delete details.requestHeaders['User-Agent'];
return {requestHeaders: details.requestHeaders};
},
{},
["blocking"]);
(2)这个是local的终极方案
I would use Fiddler as my debugging proxy and set the header there. See the "Add a request header" of the FiddlerScript CookBook. This same solution would work with any browser.
Fiddler is a Web Debugging Proxy which logs all HTTP(S) traffic between your computer and the Internet. Fiddler allows you to inspect all HTTP(S) traffic, set breakpoints, and "fiddle" with incoming or outgoing data. Fiddler includes a powerful event-based scripting subsystem, and can be extended using any .NET language.
(3)MAC的
I actually found an app called GrpahicalHttpClient in the Mac AppStore that's a lot easier and more enjoyable to use.
(4)FireFox的
Modify Headers on the FireFox browser