VSCode CORS
When debugging webUI projects in VSCode, it can be necessary to disable any CORS checking, so that VSCode can serve your app, while your backend API calls point elswhere.
Aside: For more information on how to debug Angular applications in VSCode, see this: Debugging Angular in VSCode
Any easy way to accomplish this, is to disable web security of the node runtime that is hosting the app (for VSCode).
To do this, add a --disable-web-security switch to the runtime arguments of your debug startup.
Below, is a launch.json file of an Angular project in VSCode. It contains a debug startup called, start-scratchdev.
We add this line to it: "runtimeArgs": ["--disable-web-security"]
The above runtime argument addition allows the node hosting process of our debugger session, to let the app make API calls to a different origin.
No Comments