🛠️ Debugging Like a Pro: Content & Headers Overrides in DevTools
When we think about debugging, most developers picture console.log() or breakpoints. But there’s a lesser-known, highly powerful technique: Content & Headers Overrides in DevTools.
🔎 What is it?
It’s the ability to modify server responses directly from your browser, without changing the real backend. This includes files (HTML, CSS, JS, images) and HTTP headers (CORS, cache-control, Content-Type, etc.).
Chrome DevTools allows you to:
- Save modifications in a local folder you configure.
- Serve your local version instead of the server’s when reloading.
- Disable the cache automatically when overrides are active.
👉 Think of it as a browser-based sandbox.
⚙️ How does it work?
To get started, you’ll need to enable overrides and select a local folder to save your changes. The files you override will be saved there and the browser will automatically use them instead of the originals from the server.
Step-by-step guide
1. Open DevTools by right-clicking on a web page and selecting Inspect. Alternatively, use the keyboard shortcut Ctrl+Shift+I (Windows/Linux) or Cmd+Option+I (Mac).

2. In DevTools, navigate to the Sources tab.

3. In the left panel, click on the Overrides tab. If you don’t see it, click the >> icon for more tabs.

4. Click on + Select folder for overrides and choose an empty local folder on your computer. DevTools will ask for permission to access this folder; click Allow.

Once configured, you can start overriding content.
- For content overrides: Go to the Network tab, find the request you want to override, right-click it and select Override content. The file will automatically open in the Sources panel, where you can edit it. The article suggests that for convenience, especially with large responses, you use an external editor like VSCode to make the changes.
- For header overrides: In the Network tab, right-click a request and select Override headers. In the Headers panel, you can now add, modify, or delete response headers. You can use wildcards (
*) to apply header rules to multiple URLs at once.
Pro-Tip: Changes you make are automatically saved and will persist as long as DevTools is open. The overridden files will have a purple dot icon next to them in both the Network and Sources panels. To keep track of all your local changes, open the Changes panel by pressing Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (Mac) and typing “Show Changes”.
💡 Practical Use Cases
- Testing fixes without touching the backend: For example, patching a JS bug in production locally before deploying it.
- Simulating CORS headers: Add or adjust
Access-Control-Allow-Originto validate integrations without needing a backend change. - Simulating specific errors or responses: Edit the API JSON to test how your UI handles incomplete or incorrect data, or even simulate a 500 server error to ensure your error handling is robust. This feature is particularly useful for quickly checking UI behavior without a full API implementation.
- Creating a quick mock: You can use this feature as a simple mock server to test different data patterns without needing to set up a local server.
- Live demonstrations: This capability allows you to show different data or scenarios in a live demo without having to modify the real server logic.
- Faster validation in complex environments: In companies with long deployment pipelines, overrides accelerate local checks and allow you to quickly test a fix or feature without going through the entire build and deploy cycle.
- Experimenting with performance: You can remove render-blocking resources or test different asset loading strategies to see their impact on page speed.
📌 Limitations
- Changes made in the Elements panel DOM are not saved. To make a persistent change, you must edit the file directly in the Sources panel.
- Inline CSS in HTML cannot be overridden from Styles; edit it from Sources instead.
- Overrides are local to your machine and browser profile; they do not affect other users.
🎯 Conclusion
Overrides in DevTools turn your browser into a local testing lab. They streamline the test–fail–adjust cycle, reduce backend dependency, and allow you to simulate real-world scenarios that would otherwise be difficult to reproduce.
More than just a debugging trick, it’s a productivity booster and a developer learning accelerator. 🚀
📚 References
- Chrome DevTools Overrides – official documentation
- DevTools Tips: Override and mock network responses
- Local Overrides in Chrome Dev Tools
- Override Network Response (zenn.dev) Source of the images and some content in this article.