Enable CORS from front-end in React with axios?

前端 未结 3 594
无人共我
无人共我 2021-02-14 10:25

I am using React on the front-end and I\'m calling API from another domain which I don\'t own. My axios request:

axios(requestURL, {
        method: \'GET\',
           


        
3条回答
  •  花落未央
    2021-02-14 10:45

    One can use CORS-anywhere. It is a NodeJS reverse proxy which adds CORS headers to the proxied request.

    If I want to add CORS to https://test-example.com, then I'd just do it as follows:

    https://cors-anywhere-herokuapp.com/https://test-example.com
    

提交回复
热议问题