IPFS Config on windows 10

I’m trying to execute these commands on windows 10 powershell

./ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["*"]'
./ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods "[\"PUT\", \"POST\", \"GET\"]"
./ipfs config --json API.HTTPHeaders.Access-Control-Allow-Credentials '["true"]'

When I try the first one, I get this error:

Error: failed to unmarshal json. invalid character '*' looking for beginning of value

so I tried with this one suggested from here.

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

And the result:

Error: Unknown Command "API.HTTPHeaders.Access-Control-Allow-Origin"

How come ipfs team didn’t take this into consideration when they have windows version of it?

Anyone know the proper commands for above IPFS configs on windows 10 using powershell?

You may need to escape the * (\*).

I didn’t quite undertand that. Could you type in full command?

Try ./ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin "[\"\*\"]". Note: I don’t use windows so I have no idea if this’ll actually work.

Thanks. I ran that command but I still got the same error.

Error: Unknown Command “API.HTTPHeaders.Access-Control-Allow-Origin”

Seems like configuring CORS is not possible in windows environment.

Try using something other than powershell (e.g., git bash).

1 Like

Wow using git bash worked. Thank you so much.