1

I have IPFS daemon running on my NAS, pinning some files. I have the following config:

{
  "API": {
    "HTTPHeaders": {}
  },
  "Addresses": {
    "API": "/ip4/0.0.0.0/tcp/6001",
    "Announce": [],
    "Gateway": "/ip4/0.0.0.0/tcp/8080",
    "NoAnnounce": [],
    "Swarm": [
      "/ip4/0.0.0.0/tcp/4001",
      "/ip6/::/tcp/4001",
      "/ip4/0.0.0.0/udp/4001/quic",
      "/ip6/::/udp/4001/quic"
    ]
  },
  "AutoNAT": {},

  },

...

  "Gateway": {
    "APICommands": [],
    "HTTPHeaders": {
      "Access-Control-Allow-Headers": [
        "X-Requested-With",
        "Range",
        "User-Agent",
        "Access-Control-Expose-Headers"
      ],
      "Access-Control-Allow-Methods": [
        "GET", "POST"
      ],
      "Access-Control-Allow-Origin": [
        "*"
      ],
         "X-Special-Header": [       "Access-Control-Expose-Headers: Ipfs-Hash"    ]
    },
    "NoDNSLink": false,
    "NoFetch": false,
    "PathPrefixes": [],
    "PublicGateways": null,
    "RootRedirect": "",
    "Writable": true
  },



I changed the port from 5001 to 6001 because the NAS is running Nginx and serving its web UI on 5001.

My companion and desktop on another machine on the network are unable to access the API and can't seem to connect to the node, despite the node working fine (direct access to pinned files works).

Which settings do I need to change to allow connecting to the node from network devices?

2
  • Can you ping the NAS from those devices? Local network might be isolating IPs? Jan 3, 2021 at 17:57
  • I can ping it from all network connected devices, yes
    – Swader
    Jan 4, 2021 at 20:29

1 Answer 1

0

The configuration is missing the CORS permission in its API section:

{
  "API": {
    "HTTPHeaders": {
      "Access-Control-Allow-Origin": ["*"]
    }
  },

...

Originally answered by Hector here: https://discuss.ipfs.io/t/network-access-to-api/9742/5

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.