Skip to content

Instantly share code, notes, and snippets.

@luciopaiva
Last active October 23, 2023 09:49
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luciopaiva/998c42359cedef8f41c0e00a76ef2764 to your computer and use it in GitHub Desktop.
Save luciopaiva/998c42359cedef8f41c0e00a76ef2764 to your computer and use it in GitHub Desktop.

CORS issues when running via Webstorm

Jetbrains had a Chrome extension where you could configure Webstorm to include CORS headers just fine, but it seems to not be working anymore (setting the field and hitting the apply button has no effect - reloading the extension configuration page shows that the field is still empty).

This comment was what helped me, but it was not enough. I reply to that comment with the extra instructions needed. Here's the full conversation in case that page goes down:


Ekaterina Prigara says: August 14, 2019 at 10:17 am Sorry for the delayed reply. After some investigation, we have found out that This is A result of the new Chrome’s security policy that disallows Cross-Origin Requests in the extensions: https://www.chromium.org/Home/chromium-security/extension-content-script-fetches We have a feature request about allowing to configure a Access-Control-Allow-Origin header in the WebStorm’s built-in web server: https://youtrack.jetbrains.com/issue/WEB-34525 Please vote for it and follow it for the updates. As a workaround, you can disable security in the browser by passing a --disable-web-security flag to it. WebStorm by default starts debugging your apps in a new instance of Chrome without using an additional extension, so you can pass the flag only to that new instance: go to the IDE Preferences | Tools | Web Browsers – select on Chrome and then click on the Edit icon; add –disable-web-security to the Command Line Options field. If you have previously enabled the option Use Chrome Extension in Preferences | Build, Execution, Deployment | Debugger | Live Edit, please disable it. Hope it helps!

Lucio Paiva says: November 3, 2019 at 12:16 am Thanks, Ekaterina! Your solution worked for me, but I also had to first close my running Chrome instance. Also, passing only --disable-web-security was not enough; I also had to select the option “Use custom user data directory” (the default value provided by Webstorm worked fine for me: /Users/myuser/Library/Preferences/WebStorm2019.2/chrome-user-data). macOS Catalina (10.15) here, running Webstorm 2019.2.3 Build #WS-192.6817.13.


Once your custom Chrome process is running, you can run your user's Chrome again. Open the terminal and run:

open -n -a Google\ Chrome

This discussion also helped me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment