Serverless Framework with AWS cognito generates CORS error

前端 未结 3 997
别那么骄傲
别那么骄傲 2020-12-12 04:42

I get this error message from the Angular frontend and I am not authorized to touch my lambda code:

`Access to fetch at \'https://testapicd.***.***.com/local         


        
3条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-12 05:17

    The CORS error is thrown when you are making requests to servers in other domains. Depending on the server you are using to host the angular code there are many ways you can solve this.

    You can try this google chrome extension to see if you can effectivelly fix the problem by ignoring the CORS errors.

    One of the most commons ways to solve this problem is to configure a proxy server, but you can also solve it by whitelisting your test domain manipulating the header Access-Control-Allow-Origin in your requests.

提交回复
热议问题