Fix CORS errors in Angular (when you have access to API) | QUICK FIX
Video Statistics and Information
Channel: Devstackr
Views: 115,654
Rating: undefined out of 5
Keywords: cors, error, fix, Cross-Origin Request Blocked, CORS header, access-control-allow-origin, access control, allow origin, access control allow origin
Id: Whgr8DKfs6U
Channel Id: undefined
Length: 2min 16sec (136 seconds)
Published: Sun Feb 10 2019
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.
Please don't do this, if you are only struggling with CORS during development using the Angular CLI Server (ng serve). It's better to just use the proxy feature (have a look at https://github.com/angular/angular-cli/blob/master/docs/documentation/stories/proxy.md ).
This has just nothing to do with Angular...
In the future, it would be nice if you explain what the headers do and why the "error" happens and how by adding the headers solves the "error". It is important to know.
CORS is a web server security setting that browsers voluntarily abide by.
Does this method get rid of the warning in the browser developer console? Yes it does.
Would learning the proper CORS settings of your chosen web server be better? 10/10 times, yes it would be better to leverage CORS security settings properly.