![](/img/trans.png)
[英]Trying to make a GET request from localhost:8080 to localhost:3000 but I get a cors error, and installing cors on my node.js server doesn't fix it
[英]Make a request from my localhost client without cors error
我需要從我的 localhosted nodejs/express js 客戶端向我托管在雲上的第 3 方 API 發出請求。 但是,每次我嘗試時都會出現 cors 錯誤。 奇怪的是,當我使用我的 nodejs 應用程序執行來自郵遞員的相同請求而不是來自 localhost 的請求時,它會起作用。
$.ajax({
type: "POST",
url: url,
data: file,
processData: false,
contentType: false,
})
有什么建議嗎?
請您分享有關問題的更多詳細信息並分享 package.json 文件。
解決方案:- 使用代理來避免 CORS 錯誤。獲取此https://github.com/Rob--W/cors-anywhere/issues/301 的參考它可能會幫助您
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.