Failed to get configured IPFS gateway. Is the IPFS daemon running?

Failed to get configured IPFS gateway. Is the IPFS daemon running?_json

 

fiddler监听 403错误

Failed to get configured IPFS gateway. Is the IPFS daemon running?_vim_02

查一下403错误的含义

Failed to get configured IPFS gateway. Is the IPFS daemon running?_vim_03

猜测是设置问题

 

Failed to get configured IPFS gateway. Is the IPFS daemon running?_vim_04

单独访问 是可以的

 

解决办法:

将上面命令修改成如下方式如:
$ 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\"]"

 

 

Failed to get configured IPFS gateway. Is the IPFS daemon running?_docker_05

Failed to get configured IPFS gateway. Is the IPFS daemon running?_docker_06

 

ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["*"]'

ipfs config --json Addresses.API '"/ip4/0.0.0.0/tcp/5001"' 

ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "GET", "POST", "OPTIONS"]' 
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Credentials '["true"]' 
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Headers '["Authorization"]' 
ipfs config --json API.HTTPHeaders.Access-Control-Expose-Headers '["Location"]'

ipfs config --json Gateway.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "GET", "POST", "OPTIONS"]' 

尝试失败,修改错误

[giser@izbp182lz6444d7n8bnvx4z ipfs]$ docker exec ipfs_host ipfs config --json?Gateway.Access-Control-Allow-Methods '["PUT", "GET", "POST", "OPTIONS"]'?
Error: unknown option "json\u00a0Gateway.Access-Control-Allow-Methods"
[giser@izbp182lz6444d7n8bnvx4z ipfs]$
[giser@izbp182lz6444d7n8bnvx4z ipfs]$ docker exec ipfs_host ipfs config --json?Gateway.Access-Control-Allow-Methods '["PUT", "GET", "POST", "OPTIONS"]'?
Error: unknown option "json\u00a0Gateway.Access-Control-Allow-Methods"
[giser@izbp182lz6444d7n8bnvx4z ipfs]$ docker exec ipfs_host ipfs config --json?Gateway.Access-Control-Allow-Methods'["PUT", "GET", "POST", "OPTIONS"]'?
Error: unknown option "json\u00a0Gateway.Access-Control-Allow-Methods[\"PUT\", \"GET\", \"POST\", \"OPTIONS\"]\u00a0"
[giser@izbp182lz6444d7n8bnvx4z ipfs]$ docker exec ipfs_host ipfs config --json Gateway.Access-Control-Allow-Methods'["PUT", "GET", "POST", "OPTIONS"]'
Error: failed to get config value: "Gateway key has no attributes"
[giser@izbp182lz6444d7n8bnvx4z ipfs]$ docker exec ipfs_host ipfs config --json Gateway.HTTPHeaders.Access-Control-Allow-Methods'["PUT", "GET", "POST", "OPTIONS"]'
Error: failed to get config value: "Gateway.HTTPHeaders key has no attributes"

 

直接修改文件

 cd /tmp/ipfs_data

sudo vim config // 直接vim没有权限

[giser@izbp182lz6444d7n8bnvx4z ipfs]$ docker exec ipfs_host ipfs config show
{
"API": {
"HTTPHeaders": {
"Access-Control-Allow-Credentials": [
"true"
],
"Access-Control-Allow-Headers": [
"Authorization"
],
"Access-Control-Allow-Methods": [
"PUT",
"GET",
"POST",
"OPTIONS"
],
"Access-Control-Allow-Origin": [
"*"
],
"Access-Control-Expose-Headers": [
"Location"
],
"Server": [
"go-ipfs/0.4.17"
]
}
},
"Addresses": {
"API": "/ip4/0.0.0.0/tcp/5001",
"Announce": [],
"Gateway": "/ip4/0.0.0.0/tcp/8080",
"NoAnnounce": [],
"Swarm": [
"/ip4/0.0.0.0/tcp/4001",
"/ip6/::/tcp/4001"
]
},
"Bootstrap": [
"/ip4/172.17.0.4/tcp/4001/ipfs/QmappZkdBgb1vBoqJfU9XradJvFvwWsy3bYKF1YQKTtaWD",
"/ip4/172.17.0.6/tcp/4001/ipfs/QmUnxtTtYqb89g5Snrod6c614VPeJ4B3GyiWJ5LZpKBqeK"
],
"Datastore": {
"BloomFilterSize": 0,
"GCPeriod": "1h",
"HashOnRead": false,
"Spec": {
"mounts": [
{
"child": {
"path": "blocks",
"shardFunc": "/repo/flatfs/shard/v1/next-to-last/2",
"sync": true,
"type": "flatfs"
},
"mountpoint": "/blocks",
"prefix": "flatfs.datastore",
"type": "measure"
},
{
"child": {
"compression": "none",
"path": "datastore",
"type": "levelds"
},
"mountpoint": "/",
"prefix": "leveldb.datastore",
"type": "measure"
}
],
"type": "mount"
},
"StorageGCWatermark": 90,
"StorageMax": "10GB"
},
"Discovery": {
"MDNS": {
"Enabled": true,
"Interval": 10
}
},
"Experimental": {
"FilestoreEnabled": false,
"Libp2pStreamMounting": false,
"ShardingEnabled": false,
"UrlstoreEnabled": false
},
"Gateway": {
"HTTPHeaders": {
"Access-Control-Allow-Headers": [
"X-Requested-With",
"Range"
],
"Access-Control-Allow-Methods": [
"GET"
],
"Access-Control-Allow-Origin": [
"*"
]
},
"PathPrefixes": [],
"RootRedirect": "",
"Writable": false
},
"Identity": {
"PeerID": "QmeoxpCtQ4ZKrbdmWDtnkRXb3CHLuPwTMzX1Vn896aw8T1"
},
"Ipns": {
"RecordLifetime": "",
"RepublishPeriod": "",
"ResolveCacheSize": 128
},
"Mounts": {
"FuseAllowOther": false,
"IPFS": "/ipfs",
"IPNS": "/ipns"
},
"Reprovider": {
"Interval": "12h",
"Strategy": "all"
},
"Routing": {
"Type": "dht"
},
"Swarm": {
"AddrFilters": null,
"ConnMgr": {
"GracePeriod": "20s",
"HighWater": 900,
"LowWater": 600,
"Type": "basic"
},
"DisableBandwidthMetrics": false,
"DisableNatPortMap": false,
"DisableRelay": false,
"EnableRelayHop": false
}

Failed to get configured IPFS gateway. Is the IPFS daemon running?_json_07

 

添加

Failed to get configured IPFS gateway. Is the IPFS daemon running?_json_08

Failed to get configured IPFS gateway. Is the IPFS daemon running?_json_09