I currently have a JAVA Spring Boot Api deployed on render. When running the server locally, I am able to call the api from both my React frontend and Postman. However, when I call the same api after it has been hosted on render, I get this error:
localhost/:1 Access to XMLHttpRequest at 'https://camanager.onrender.com/api/v1/users/saeed' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
When the api is run locally, responses returned from the api contain the “Access-Control-Allow-Origin: *” header. However, after the api is hosted on Render, the response header “Access-Control-Allow-Origin: *” is removed for some reason.
Lastly, it is worth mentioning that I can interact with the api when it is hosted on Render perfectly well using POSTMAN, however, not through my react app.
Any help is appreciated.