![](/img/trans.png)
[英]getting error : Could not proxy request /api/plaid/accounts from localhost:3000 to http://localhost:5000/
[英]Docker proxy error: Could not proxy request /api/product/B002QYW8LW from localhost:3000 to http://localhost:5000
我正在嘗試通過 docker 托管我的應用程序,但出現此錯誤:
client_1 | Proxy error: Could not proxy request /api/product/B002QYW8LW from localhost:3000 to http://localhost:5000.
client_1 | See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNREFUSED).
使用以下設置,它在本地適用於我。 我通過谷歌搜索了這個,它似乎與代理設置有關。 有些人能夠將代理設置為 object,但它給了我一個錯誤,說代理需要是一個字符串。 這就是為什么我決定再次在這里問這個問題。 有人可以幫忙嗎?
為了節省空間,我刪除了 package.json 中無關緊要的東西。
package.json 用於服務器:
{
"name": "",
"version": "",
"description": "",
"main": "src/server.js",
"scripts": {
},
"repository": {
},
"author": "",
"license": "",
"bugs": {
},
"homepage": ""
"dependencies": {},
"devDependencies": {
}
}
package.json 客戶端:
{
"name": "client",
"version": "0.1.0",
"private": true,
"dependencies": {
},
"scripts": {
},
"eslintConfig": {
},
"browserslist": {
"production": [],
"development": []
},
"proxy": "http://localhost:5000"
}
容器:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e4b55b165c9a productfetching_client "npm start" 24 hours ago Up 24 hours 0.0.0.0:3000->3000/tcp productfetching_client_1
10581d34d189 productfetching_server "node server.js" 24 hours ago Up 24 hours 0.0.0.0:5000->5000/tcp productfetching_server_1
使用在 docker-compose 文件中注冊的容器名稱,如評論或http://0.0.0.0:PORT
中所述,它指向本地容器網絡地址,而不是 localhost 或 127.0.0.1 指向您的常規機器網絡。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.