News Froggy
newsfroggy
HomeTechReviewProgrammingGamesHow ToAboutContacts
newsfroggy

Your daily source for the latest technology news, startup insights, and innovation trends.

More

  • About Us
  • Contact
  • Privacy Policy
  • Terms of Service

Categories

  • Tech
  • Review
  • Programming
  • Games
  • How To

© 2026 News Froggy. All rights reserved.

TwitterFacebook
Programming

Unblock Frontend: Override API Responses & Headers in Chrome DevTools

This guide demonstrates how frontend developers can use Chrome DevTools to override API responses and headers locally. It covers fixing incorrect data, validating UI scenarios, and resolving CORS errors by manipulating network requests and their properties, enabling continuous development despite backend dependencies.

PublishedMarch 27, 2026
Reading Time7 min
Unblock Frontend: Override API Responses & Headers in Chrome DevTools

As frontend developers, we frequently find ourselves dependent on backend APIs. What happens when an API returns an incorrect response, blocks us with a CORS error, or simply doesn't provide the data needed to validate a UI scenario? Waiting for backend fixes can derail our sprints and demos.

Fortunately, Chrome DevTools offers powerful features to override API responses and headers locally, empowering us to continue our work without being blocked. This guide will walk you through these essential techniques, ensuring you can stay productive and independent.

The Challenge: When Backend APIs Become Roadblocks

Consider these common scenarios:

  1. Incorrect Data: An API returns data with a typo (e.g., "Banananana" instead of "Banana"), preventing accurate UI display or validation.
  2. Missing Test Data: You need to test a specific UI state, like a "Low Stock" warning when an item's quantity falls below a threshold, but the current API response doesn't provide such data.
  3. CORS Errors: Your frontend application (running on localhost:5174) tries to access an API on a different domain, leading to a Cross-Origin Resource Sharing (CORS) error that completely blocks the request.

In an ideal world, the backend team would provide immediate fixes. But reality often dictates otherwise, leaving us scrambling to meet deadlines. This is where Chrome DevTools' local overrides become invaluable.

Overriding API Responses (Content Overriding)

Let's address the issue of incorrect or missing response data using the Content Overriding feature.

Step-by-Step Guide:

  1. Open DevTools: Press F12 (or Cmd+Option+I on Mac) to open Chrome DevTools. Navigate to the Network tab.
  2. Identify the Request: Find the specific API request that returns the problematic response. You might need to refresh the page to capture it.
  3. Initiate Override: Right-click on the target network request and select the Override content option from the context menu.
  4. Select Override Folder: A prompt will appear at the top of the DevTools window, asking you to select a local folder to store the override files. Choose an existing folder or create a new one (e.g., debug_devtools). This step is crucial because all your overrides are saved persistently on your local file system, meaning they'll remain active even after you close and reopen Chrome.
  5. Grant Permissions: Chrome will ask for confirmation to allow DevTools to edit files in the selected folder. Click Allow.
  6. Edit the Response: Now, switch to the Sources tab, and then the Overrides sub-tab. Here, you'll see a hierarchical view mirroring your selected folder, the domain of the API endpoint (e.g., localhost:3001), and a file representing the API response (e.g., edibles). The content of this file will be editable in the right-side panel. Make the necessary changes (e.g., correct "Banananana" to "Banana" or adjust a product's quantity to 50).
  7. Save and Refresh: Save your changes using Ctrl + S (or Cmd + S on Mac). Perform a hard refresh of your browser (Ctrl+Shift+R or Cmd+Shift+R) to ensure the browser fetches the overridden content. You should now see your changes reflected in the UI.

This method allows you to instantly visualize UI changes based on different data scenarios or correct temporary backend issues, accelerating your development and testing cycles. You can even share these .json (or similar) override files with teammates for consistent local testing environments.

Overriding API Headers: Conquering CORS

CORS errors are a common pain point for frontend developers, especially when working with APIs hosted on different domains. Browsers enforce Same-Origin Policy, preventing cross-origin requests unless explicitly allowed by the server via specific response headers. While the ideal fix is server-side, Header Overriding provides an immediate workaround.

Step-by-Step Guide:

  1. Open DevTools and Network Tab: As before, open DevTools (F12) and go to the Network tab.

  2. Identify Failed Request: Locate the API request that resulted in a CORS error. You'll notice that the Override content option is often disabled for such requests, as there's no successful content to override.

  3. Initiate Header Override: Right-click on the failed request and select Override headers.

  4. Add CORS Headers: This will take you to the Headers tab, specifically to an editable section for response headers. Click the + Add header button.

  5. Define CORS-related Headers: Add the following standard CORS headers one by one, customizing Access-Control-Allow-Origin to match your frontend application's origin:

    Access-Control-Allow-Origin: http://localhost:5174 Access-Control-Allow-Methods: GET Access-Control-Allow-Headers: *

    • Access-Control-Allow-Origin: Specifies the origin(s) permitted to make cross-origin requests. Replace http://localhost:5174 with your application's actual origin.
    • Access-Control-Allow-Methods: Lists the HTTP methods (e.g., GET, POST, PUT, DELETE) allowed from the specified origin.
    • Access-Control-Allow-Headers: Indicates which HTTP headers are permitted in the cross-origin request.
  6. Save and Refresh: Save the header changes (Ctrl + S or Cmd + S). Perform a hard refresh of your browser. The CORS error should now be resolved, and your application can successfully make the API call.

This technique allows you to simulate a correctly configured backend for CORS, letting you proceed with frontend development even when the server-side CORS policy is not yet in place.

Advanced Tips for Overrides

Applying Overrides Globally

If you need a specific header override (like the CORS headers) to apply to all requests from a particular domain, you can easily broaden its scope:

  1. Go to the Sources tab, then the Overrides sub-tab.
  2. Select the .headers override file associated with your domain.
  3. In the right-side panel, locate the Apply to field and change its value from a specific endpoint path to * (an asterisk). This wildcard ensures the headers are applied universally.

Disabling or Removing Overrides

To manage your overrides:

  • Disable: Uncheck the Enable Local Overrides checkbox in the Sources > Overrides tab to temporarily deactivate all overrides without deleting them.
  • Remove All: Click the stop icon (a circle with a slash) at the top-right of the Overrides panel to clear all configured overrides.
  • Remove Selectively: Right-click on a specific override file or folder in the Overrides panel and choose Delete to remove it permanently.

These Chrome DevTools override capabilities are powerful tools for any frontend developer. They offer a temporary but effective way to navigate backend dependencies, troubleshoot UI issues, and maintain momentum in your development workflow.

FAQ

Q: Are Chrome DevTools overrides permanent or specific to my browser?

A: Overrides are stored persistently on your local file system within a chosen folder. This means they remain active even after closing and reopening Chrome. However, they are local to your machine and browser profile; they don't affect other browsers or machines, nor do they impact the actual remote API.

Q: Can I override responses for POST requests too, or just GET?

A: Yes, you can override responses for any HTTP method, including POST, PUT, DELETE, etc., as long as the request appears in the Network tab and generates a response or error you can intercept. The Override content feature applies to the response body regardless of the request method.

Q: What are the security implications of using overrides?

A: Overrides are strictly client-side and local to your browser's DevTools. They do not interact with or modify the actual server or API. They are safe to use for local development and debugging purposes. However, it's crucial to remember to disable or remove them when you no longer need them to avoid unexpected behavior during normal browsing or testing of real API responses.

#frontend#debugging#chrome-devtools#api#web-development

Related articles

Unlock Desktop Chrome Extensions on Your Android Phone with Kiwi
How To
MakeUseOfApr 9

Unlock Desktop Chrome Extensions on Your Android Phone with Kiwi

For years, a common frustration for Android users has been the absence of Chrome extensions. Imagine having access to your favorite desktop browser tools, like ad blockers, grammar checkers, or dark mode enforcers,

Building Responsive, Accessible React UIs with Semantic HTML
Programming
freeCodeCampApr 8

Building Responsive, Accessible React UIs with Semantic HTML

Build responsive and accessible React UIs. This guide uses semantic HTML, mobile-first design, and ARIA to create inclusive applications, ensuring seamless user experiences across devices.

Beyond Vibe Coding: Engineering Quality in the AI Era
Programming
Hacker NewsApr 7

Beyond Vibe Coding: Engineering Quality in the AI Era

The concept of 'vibe coding,' an extreme form of dogfooding where developers avoid inspecting AI-generated code, often leads to significant quality issues. A more effective approach involves actively guiding AI tools to clean up technical debt and refactor, treating them as powerful assistants under human oversight. Ultimately, maintaining high software quality, even with AI, remains a deliberate choice for developers.

Programming
Hacker NewsApr 5

Offline-First Social Systems: The Rise of Phone-Free Venues

Mobile technology, while streamlining communication and access, has also ushered in an era of constant digital distraction. For developers familiar with context switching and notification fatigue, the impact on

Lisette: Rust-like Syntax, Go Runtime — Bridging Safety and
Programming
Hacker NewsApr 5

Lisette: Rust-like Syntax, Go Runtime — Bridging Safety and

Lisette is a new language inspired by Rust's syntax and type system, but designed to compile directly to Go. It aims to combine Rust's compile-time safety features—like exhaustive pattern matching, no nil, and strong error handling—with Go's efficient runtime and extensive ecosystem. This approach allows developers to write safer, more expressive code while seamlessly leveraging existing Go tools and libraries.

Linux 7.0 Halves PostgreSQL Performance: A Kernel Preemption Deep Dive
Programming
Hacker NewsApr 5

Linux 7.0 Halves PostgreSQL Performance: A Kernel Preemption Deep Dive

An AWS engineer reported a dramatic 50% performance drop for PostgreSQL on the upcoming Linux 7.0 kernel, caused by changes to kernel preemption modes. While a revert was proposed, kernel developers suggest PostgreSQL should adapt using Restartable Sequences (RSEQ). This could mean significant performance issues for databases on Linux 7.0 until PostgreSQL is updated.

Back to Newsroom

Stay ahead of the curve

Get the latest technology insights delivered to your inbox every morning.