| 知乎專欄 | 多維度架構 | | | 微信號 netkiller-ebook | | | QQ群:128659835 請註明“讀者” |
目錄
如果你遠程訪問 webui 會議都 403 問題,需要配置 IPFS 然後重啟 ipfs daemon
ipfs config show ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "GET", "POST", "OPTIONS"]' ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["*"]' ipfs config --json API.HTTPHeaders.Access-Control-Allow-Credentials '["true"]' ipfs config show
修改後如下
"HTTPHeaders": {
"Access-Control-Allow-Credentials": [
"true"
],
"Access-Control-Allow-Methods": [
"PUT",
"GET",
"POST",
"OPTIONS"
],
"Access-Control-Allow-Origin": [
"*"
],
"Server": [
"go-ipfs/0.4.17"
]
}
},
生產環境需要嚴格配置 CORS
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin "[\"http://example.com\"]" ipfs config --json API.HTTPHeaders.Access-Control-Allow-Credentials "[\"true\"]" ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods "[\"PUT\", \"POST\", \"GET\"]"