HTTP request works with cURL but gets CORS response when made in browser with javascript

后端 未结 2 757
眼角桃花
眼角桃花 2021-01-19 15:50

When I access the typeform API via browser using $.get or superagent or request or axios, I get the error No \'Access-Control-Allow-Origin\' header is present on the request

相关标签:
2条回答
  • 2021-01-19 16:32

    CORS error can be manipulated through htaccess easily.

    Add this to your .htaccess file: (add more file extensions as you need)

    <FilesMatch ".(eot|ttf|otf|woff)">
        Header set Access-Control-Allow-Origin "*"
    </FilesMatch>
    
    0 讨论(0)
  • 2021-01-19 16:39

    CORS is enforced client side by your browser. If you are not making the request with a browser CORS is not enforced.

    0 讨论(0)
提交回复
热议问题