1

I'm running a Tezos network locally using babylonnet.sh. Works fine, can query for example ./babylonnet.sh client list known addresses. Also works in browser for example http://127.0.0.1:8732/chains/main/blocks/head.

When I try and run a local server, and connect I get a cors error:

localhost/:1
Failed to load http://localhost:8732/chains/main/blocks/head/context/contracts/tz1ZQu5ZwCBP6QeTDwkrUHiUBzHtXi9gFqGF/balance
: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'http://localhost:8000' is therefore not allowed access.

I can't see how to set the cors using babylonnet.sh docker

1

The babylonnet.sh script accepts node options. You can inspect the node options via tezos-node run --help. The option you're looking for is:

--cors-origin=ORIGIN: CORS origin allowed by the RPC server via Access-Control-Allow-Origin; may be used multiple times

3
  • Thanks! I got it working using this: ./babylonnet.sh start --rpc-port 127.0.0.1:8732 --cors-origin=http://localhost:8000 --cors-origin=node:8732 --cors-origin=localhost:8732. Just adding localhost:8000 didn't work because some of the containers were using node:8732. But great stuff, I can start building now Feb 3 '20 at 13:21
  • Also, I ran --help and could't find reference to cors. I can't find a reference on the docs too. Am I missing something? If it is missing it might be worth doing a pr. I'll look into that if so Feb 3 '20 at 13:22
  • I'm guessing you're looking in the script's help, but this is located in the help of tezos-node config. I think with the script you can use ./babylonnet.sh shell tezos-node config --help to access this. Feb 4 '20 at 11:33

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.