Response ModifyCORS & Cache• 4 min read
How to Bypass CORS Errors and Modify Response Headers
Summary: Inject `Access-Control-Allow-Origin: *` and customize caching directives to test cross-origin APIs and inspect stale-while-revalidate behavior.
Why This Rule Matters for Developers & QA
CORS preflight failures are among the most common blockers when integrating third-party APIs or running localhost frontends against remote staging APIs. Response Header modification eliminates CORS errors instantly.
Step-by-Step Implementation Guide
1
Select Cross-Origin Target URL
Enter the domain of the remote API causing CORS issues (e.g. `https://api.externalpartner.com/*`).
2
Inject CORS Headers
Add `Access-Control-Allow-Origin: *` and `Access-Control-Allow-Headers: *`.
3
Refresh the Application
The browser receives the required permissive headers and executes the fetch request without blocking.
Configuration Snippet
{
"id": "rule_bypass_cors",
"pattern": "https://api.externalpartner.com/*",
"action": "modify-response-headers",
"responseHeaders": {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, OPTIONS",
"Access-Control-Allow-Headers": "Content-Type, Authorization",
"Cache-Control": "no-store, no-cache, must-revalidate"
},
"enabled": true
}