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

Programming
Hacker NewsJun 2

Great Question (YC W21) Seeks Applied AI Interns: A Deep Dive

As fellow developers, we’re constantly scanning the landscape for companies pushing the boundaries, especially in the rapidly evolving AI space. Great Question, a Y Combinator W21 alumnus, has caught our eye with an

Navigating the Global AI Arena: Beyond Silicon Valley's Borders
Programming
Stack Overflow BlogJun 2

Navigating the Global AI Arena: Beyond Silicon Valley's Borders

The international AI landscape presents unique challenges and opportunities, requiring developers to think beyond traditional tech hubs. Key aspects include adapting AI models to local languages and cultures, navigating the complex global supply chain for critical hardware like semiconductors, and understanding how venture capital assesses these international ventures. Success hinges on deep local market understanding, robust technical solutions for localization, and resilience against logistical hurdles.

Programming
Hacker NewsJun 2

Engineering a Solution: Debugging Global Mosquito-Borne Diseases

As developers, we're constantly tasked with solving complex problems, whether it's optimizing a database query or architecting a distributed system. But what if the 'bug' we're trying to fix is biological, with global

Self-Host S3-Compatible Object Storage with MinIO on Staging
Programming
freeCodeCampJun 2

Self-Host S3-Compatible Object Storage with MinIO on Staging

This guide demonstrates how to self-host an S3-compatible object store using MinIO on your staging server. By leveraging Docker Compose and Traefik for HTTPS, you can significantly reduce cloud storage costs while maintaining a production-like environment for development and testing. It covers setup, application configuration, and secure file interactions.

Programming
Hacker NewsJun 1

Unleashing LLMs: A 10-Year-Old Xeon is All You Need

This article explores how a 10-year-old Intel Xeon E5-2620 v4 server with 128 GB DDR3 RAM and no GPU can run a modern LLM like Gemma 4 26B-A4B at reading speed. It highlights that LLM inference is often memory-bound and showcases deep optimization techniques using `ik_llama.cpp`, including speculative decoding, CPU-aware MoE routing, advanced memory management, and specialized attention kernels. The success demonstrates that granular software control can unlock significant performance on older, abundant-RAM hardware.

Secluso: Building Private Home Security on Raspberry Pi with E2EE
Programming
Hacker NewsMay 30

Secluso: Building Private Home Security on Raspberry Pi with E2EE

Reclaiming Privacy in Home Security with Secluso For many developers, the allure of smart home technology, including security cameras, is strong. Yet, the widespread reliance on cloud-based services for video storage

Back to Newsroom

Stay ahead of the curve

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