To intercept HTTP requests, use the webRequest
API. This API enables you to add listeners for various stages of making an HTTP request. In the listeners, you can:
- get access to request headers and bodies, and response headers
- cancel and redirect requests
- modify request and response headers
In this article we'll look at three different uses for the webRequest
module:
- Logging request URLs as they are made.
- Redirecting requests.
- Modifying request headers.