origin 'http://localhost:4200' has been blocked by CORS policy in Angular12

 Solution 1 - you need to change your backend to accept your incoming requests

Solution 2 - using Angular proxy see here

Please note this is only for ng serve, you can't use proxy in ng build

Solution 3 - IF your backend accepts requests from a wildcard domanin like *.testdomain.example then you can edit your hosts file and add 127.0.0.1 local.testdomain.example in there, then in your browser instead of localhost:4200 enter local.testdomain.example:4200

Note: the reason it's working via postman is postman doesn't send preflight requests while your browser does.

No comments:

Post a Comment

JavaScript + Angular-compatible version of loan amortization calculator that you can integrate into an Angular component or service

  JavaScript Version of Loan Amortization 1. Loan Calculator Function (Pure JS/TS) export function calculateLoanSchedule ( principal:...

Best for you