Modifying Request Headers
Implement rules to modify HTTP request headers, allowing for custom behavior or authentication on outgoing requests.
What are Request Headers?
When your browser talks to a website, it sends messages called HTTP requests. These requests carry extra info, like metadata, in something called headers.
Headers tell the server things like what browser you're using (User-Agent), what kind of content you expect (Accept), or even authentication tokens (Authorization).
Efficient Header Control
We learned about declarativeNetRequest for blocking and redirecting. It's powerful because it lets the browser handle rules efficiently, without your extension's JavaScript always running.
Today, we'll use it to modify these request headers, adding, changing, or removing them before a request even leaves your browser!
All lessons in this course
- Blocking Network Requests
- Modifying Request Headers
- Redirecting & Rewriting URLs
- Dynamic Rules & Debugging declarativeNetRequest