As a developer, we often face CORS issue in browser. From the Postman the API looks working but with the browser, we get the error message like this :
There is often debate between Front End and Backend team; ”the issue is from your side! we can show its working in Postman/Swagger ”.
But why the issue happens most of the time in the browser?
Most of the browsers send a preflight call to the server before POST/PUT/PATCH/DELETE to check whether it is allowed to make the actual call.
Now what is this preflight call?
A preflight request is a small request(OPTION method) sent by the browser to the server before the actual request. It contains information like which HTTP method is used, as well as if any custom HTTP headers are present. The server can then indicate whether the browser should send the actual request.