0

If i make call in dev environment with angular project (localhost:4200) to localhost:8080 server side (spring-boot application) everything works like a charm, but when i test the same process in production with angular website to google compute engine virtual machine i get the next error:

Access to XMLHttpRequest at 'http://MyServerIP/api' from origin 'http://MyClientIP' 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

i used in @CrossOrigin(origins="*") and also specipic origin address, also in the method and also in the class. but i think because the server is an vm on google cloud compute engine there is more configuration that i miss. please any idea what i miss?

also in the Response Header i dont see the Access-Control-Allow-Origin Header (on browser) this is the result:

Allow: GET, HEAD, POST, PUT, DELETE, OPTIONS
Connection: Keep-Alive
Content-Length: 0
Date: Sun, 27 Jan 2019 09:05:03 GMT
Keep-Alive: timeout=1, max=100
Server: Apache
X-Frame-Options: SAMEORIGIN,

how can i make this header to appear in the response?

Bsquare ℬℬ
  • 4,241
  • 11
  • 21
  • 40

1 Answers1

0

seems like this question has been already answered. Please take a look at that document and let me know if you could fix your issue.

Response to preflight request doesn't pass access control check