0

I'm trying to get a simple get request from a boardgame site, the link to request: https://www.boardgamegeek.com/xmlapi/boardgame/266192

In browser it works, in postman it works, but when I try httpClient.get with angular, even if I append header with

'Access-Control-Allow-Methods', 'GET'
and
'Access-Control-Allow-Origin', '*'

I still get the error:

Access to XMLHttpRequest at 'https://www.boardgamegeek.com/xmlapi/boardgame/266192' from origin 'http://localhost:4200' 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.

Kevin
  • 2,258
  • 1
  • 32
  • 40
  • 2
    you need to take some time to understand what Cors is. the server has to response with those headers, not you. the summary of this answer might help you understand https://stackoverflow.com/questions/60164489/ionic-http-client-post-request-cross-origin-error-but-works-on-postman/60164947#60164947 – Kevin Feb 20 '20 at 13:03
  • As you don't have any access to server, you can use/enable CORS extension for chrome browser which set Access-Control-Allow-Origin: * rule to the response header. – Pujan Shah Feb 20 '20 at 13:12

0 Answers0