[英]Chrome saying No 'Access-Control-Allow-Origin' header, but the header is there
[英]No 'Access-Control-Allow-Origin' header in plunker
我看到有很多關於No 'Access-Control-Allow-Origin' header
。 我的問題是關於如何在plunker中解決這個問題。
我在plunker中有一段代碼,它試圖加載一個外部html文件。 它給出了錯誤No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://run.plnkr.co' is therefore not allowed access.
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://run.plnkr.co' is therefore not allowed access.
我試圖通過open /Applications/Google\\ Chrome.app --args --disable-web-security
啟動Chrome,但它沒有幫助。
有沒有人有任何解決方法來加載外部html文件在plunker中工作?
您可以使用開放式CORS代理,例如https://cors-anywhere.herokuapp.com/ 。
它的工作方式是,而不是直接向https://site.to.request
提出請求,而是向https://cors-anywhere.herokuapp.com/https://site.to.request
提出請求。
然后https://cors-anywhere.herokuapp.com/代理添加必要的CORS標頭。
或者您可以從源代碼運行您自己的實例: https://github.com/Rob--W/cors-anywhere/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.