Enable CORS from front-end in React with axios?

前端 未结 3 1169
花落未央
花落未央 2021-02-14 10:19

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:36

    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
    

提交回复
热议问题