lundi 22 juin 2020

use of XMLHttpRequest has been blocked by CORS policy [duplicate]

My question is about my development environment, where the web application and all servers are running on my localhost. The web application I'm working on has following high level design,

  1. Requests from browser goes to an Nginx web server. I'm currently using the browsers 'edge' and 'chrome' for development. The edge version is 83.0.478.54. And chrome's version is 83.0.4103.106.
  2. Nginx works as a reverse proxy, and forwards the request to a Jetty server. The Jetty server hosts an Angular front-end app.
  3. The Angular app running on Jetty server, invokes REST APIs running on a tomcat server. The REST API implementation has business logic and also interfaces with an RDBMS database.

When I invoke a certain UI functionality on my web app on a browser, I'm getting following errors on the browser development console (on both the browsers mentioned above),

Access to XMLHttpRequest at 'http://localhost:8090/...' from origin 'http://localhost' has been 
blocked by CORS policy: Response to preflight request doesn't pass access control check: No
'Access-Control-Allow-Origin' header is present on the requested resource.

And consequently, I'm unable to use the browser based application functionality.

How can I solve the above mentioned error?




Aucun commentaire:

Enregistrer un commentaire