Disable Cross‑Domain Web Security in Firefox – Step by Step
In this article
Yes, you can temporarily relax Firefox’s cross‑domain security for development purposes by changing a hidden preference, but you should never keep it disabled for regular browsing because it removes a core protection against malicious sites.
What You’ll Need
- Firefox installed on a Windows, macOS, or Linux desktop.
- Administrator or user rights to change browser preferences.
- A clear understanding that the change is only for testing and must be reverted before normal use.
Step‑by‑Step
- Open Firefox and type
about:configin the address bar, then press Enter. A warning page appears; click Accept the Risk and Continue to proceed. - In the search box at the top of the
about:configpage, entersecurity.fileuri.strict_origin_policy. This preference controls the same‑origin policy forfile://URLs. - If the entry is not present, create it by right‑clicking anywhere in the list, choosing New > Boolean, typing the exact name
security.fileuri.strict_origin_policy, and setting the value tofalse. If it already exists, double‑click it to toggle the value fromtruetofalse. - Next, locate the
security.csp.enablepreference. Double‑click it to set the value tofalse. This disables Content‑Security‑Policy enforcement, which can also block cross‑origin requests. - For HTTP‑based CORS requests, find
network.http.cross-origin.resource.policy. If the preference does not exist, create it as a String and set its value tosame-siteorsame-origindepending on how permissive you need to be. Setting it tosame-siterelaxes the check for resources on the same site but still blocks truly cross‑domain calls. - Close the
about:configtab and restart Firefox to ensure the new settings take effect. - Test your development scenario: open the page that previously failed due to CORS or same‑origin restrictions. If the request now succeeds, the configuration change worked.
- When you are finished testing, repeat steps 1‑4 and set the values back to their defaults (
trueforsecurity.fileuri.strict_origin_policyandtrueforsecurity.csp.enable). Restart Firefox again to re‑enable full protection.
Common Mistakes
- Changing the wrong preference – many users look for
network.http.enableCrossOriginRedirects, which does not disable CORS and will not solve the problem. - Leaving the settings disabled after testing – this exposes you to cross‑site scripting, data leakage, and other attacks.
- Editing the preference in a private window –
about:configchanges are global, but some users think a private session isolates them, leading to confusion. - Expecting the change to affect extensions – extensions have their own permission model; disabling CSP in the browser does not grant them additional rights.
Tips
- Use a dedicated Firefox profile for development. Create one via
firefox -P, enable the relaxed settings there, and keep your regular profile untouched. - Document the exact values you change. A simple text note helps you revert the preferences quickly.
- If you need a more granular approach, consider using the Network Monitor to confirm which request is being blocked and why.
- For local file testing, the
security.fileuri.strict_origin_policytoggle is usually sufficient; you rarely need to touch CSP unless your app explicitly uses it.
Troubleshooting
If the cross‑domain request still fails after following the steps above, try the following checks in order:
- Restart Firefox completely. Some preference changes require a full restart, not just closing the tab.
- Verify the preference values. Re‑open
about:configand ensuresecurity.fileuri.strict_origin_policyandsecurity.csp.enableare set tofalse. A typo will cause the browser to ignore the change. - Clear the site’s cache. Open the menu > More Tools > Clear Private Data…, select Cache, and click Clear. Cached CORS headers can persist across restarts.
- Check for interfering extensions. Some security‑focused add‑ons (e.g., uBlock Origin, NoScript) enforce their own same‑origin policies. Disable them temporarily to see if they are the cause.
- Confirm the server’s response headers. Even with browser restrictions lowered, the server may still send
Access-Control-Allow-Originthat does not match your origin. Use the Network Monitor to inspect the response. - Use a temporary local web server. Serving files via
http://localhostinstead offile://often avoids the need to change the file‑origin policy. - Re‑create the profile. If the profile has become corrupted, create a fresh one and repeat only the necessary preference changes.
If none of the above resolves the issue, consider using a dedicated development proxy (e.g., cors-anywhere) that adds the required headers, rather than permanently disabling browser security.
Frequently Asked Questions
Will disabling these settings protect me from all web threats?
No. The changes only relax same‑origin and CSP checks; they do not protect against phishing, malware, or other browser‑level threats.
Do these preferences affect mobile Firefox?
The about:config page exists on Android, but many of the same preferences are hidden or read‑only. For mobile development, use a desktop profile and remote debugging instead.
Can I disable cross‑domain security for a single site only?
Firefox does not provide a per‑site toggle for these core security mechanisms. You would need to use an extension that injects custom headers, but that approach also carries security risks.
Is there an official way to re‑enable the protections?
Yes. Simply set the altered preferences back to their default values (true for both security.fileuri.strict_origin_policy and security.csp.enable) and restart the browser.
Will these changes survive a Firefox update?
Updates preserve user‑defined preferences, so the values will stay until you change them again. However, a major version change could reset certain hidden flags; always verify after a big upgrade.
Why does my extension still block the request after I changed the settings?
Extensions run in their own sandbox and can enforce additional CORS checks. Disable or re‑configure the extension if you need the request to succeed.