GuidesLOCAL DEV
Disable CORS in Chrome for local development
The fastest way to disable CORS in Chrome is a pair of command-line flags that turn off the same-origin policy for one isolated browser profile. It unblocks local API calls in seconds, but only in your browser: for a public API with no CORS headers, https://proxy.cors.dev/ in front of the URL works for every visitor. The flags also remove the protection that keeps the sites you visit from reading each other's data.
What --disable-web-security actually does
Chrome enforces the same-origin policy: JavaScript on one origin cannot read responses from another unless the server grants permission with CORS headers. The --disable-web-security flag turns that policy off for the entire browser profile. Cross-origin reads stop failing because the browser stops checking, so CORS errors, preflight failures, and opaque-response quirks all disappear at once.
Two details decide whether the flag works at all. It must be paired with a separate --user-data-dir, because current Chrome versions ignore --disable-web-security when it targets the default profile directory. And it only takes effect on a completely fresh instance: if any Chrome window or background process is already running, the new command just opens a window in the existing process and the flags are silently dropped.
Launch a CORS-disabled Chrome
- Quit Chrome completely
The flags apply only to a fresh process. On macOS quit with Cmd+Q, on Windows close every window and check the system tray for a lingering Chrome background process.
- Launch with both flags
Run the command for your operating system below. The
--user-data-dirvalue is any empty directory; Chrome builds a throwaway profile there. - Verify the flags are active
Open
chrome://versionand check the Command Line entry. If--disable-web-securityis missing from it, Chrome was already running and ignored your launch arguments.
On macOS, launch Chrome through open with the flags after --args:
open -na "Google Chrome" --args --disable-web-security --user-data-dir=/tmp/chrome-devOn Windows, call the executable directly from cmd:
"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe" --disable-web-security --user-data-dir=C:\\chrome-devOn Linux, pass the flags to the browser binary:
google-chrome --disable-web-security --user-data-dir=/tmp/chrome-devWhy this is risky
The flag does not relax CORS for your app alone. It disables the same-origin policy for every site loaded in that profile, and the same-origin policy is what stops a random page from reading your webmail, your bank session, or your company admin panel while you are logged in.
- Any site opened in the weakened profile can read responses from any other site, including authenticated responses if you sign in anywhere.
- The separate
--user-data-diris the only thing keeping the weakened browser away from your real cookies, sessions, and synced data. Never point it at your normal profile directory. - Treat the profile as disposable: no account sign-ins, no everyday browsing, and close it when the debug session ends.
- If the flags were ignored because Chrome was already running, you hit the opposite failure: nothing changed and you debug a phantom. Always confirm on
chrome://version.
Better alternatives for daily development
Disabling web security works, but it changes your browser instead of fixing the request path. Three options solve the same problem without weakening anything:
- Use proxy.cors.dev for third-party public APIs. When the API is not yours and sends no CORS headers, prefix it with proxy.cors.dev, which re-serves the response with the headers the browser needs, in your browser and in every visitor's. Public data only: the proxy operator can observe the traffic.
- Proxy through your dev server. The Vite dev server proxy forwards API calls server-side, so the browser only ever talks to its own origin and no CORS check applies. The configuration lives in your repo and works for the whole team.
- Fix the server when you own it. If the target API is yours, return the correct
Access-Control-Allow-Originheaders from it. That fix also holds in production.
Good questions.
Does --disable-web-security still work in current Chrome?
Yes, but only with a separate --user-data-dir. Chrome ignores the flag when it is combined with the default profile directory, and it only applies to a fresh instance with no other Chrome process running. Verify the active switches on chrome://version.
Do I need extra flags besides --disable-web-security?
No. Older tutorials pile on unrelated flags copied from forum posts. The only required companion is --user-data-dir, which isolates the weakened profile from your real one.
Is it safe to browse normally in that profile?
No. With the same-origin policy off, any site you open can read data from any other site in that profile, including pages you are logged into. Keep the throwaway profile empty: no sign-ins, no real browsing, and close it when you are done.
Will this fix CORS errors for my users?
No. The flags change only your local browser. Every visitor still runs a normal browser that enforces the same-origin policy, so before production a public API needs https://proxy.cors.dev/ in front of it, or your server needs to send the CORS headers if you own it.