How to solve 'Redirect has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header'?

前端 未结 17 2244
遥遥无期
遥遥无期 2020-11-27 13:12

I am working on an app using Vue js. According to my setting I need to pass to a variable to my URL when setting change.



        
17条回答
  •  一向
    一向 (楼主)
    2020-11-27 13:59

    Try running this command in your terminal and then test it again.

    curl -H "origin: originHost" -v "RequestedResource"
    

    Eg:

    If my originHost equals https://localhost:8081/ and my RequestedResource equals https://example.com/

    My command would be as below:

    curl -H "origin: https://localhost:8081/" -v "https://example.com/"
    

    If you can notice the following line then it should work for you.

    < access-control-allow-origin: *

    Hope this helps.

提交回复
热议问题