Skip to content

Commit

Permalink
feat: enable CORS for local reth (#2665)
Browse files Browse the repository at this point in the history
## What ❔
This PR adds the `--http.corsdomain "*"` option to Docker Compose files
to enable CORS (Cross-Origin Resource Sharing) on locally running Reth
nodes.

## Why ❔
Enables web applications like dapp-portal and block-explorer to make
requests to the local RPC endpoint. Without CORS enabled, browser
policies block these requests, causing the applications to fail.

## Checklist

- [x] PR title corresponds to the body of PR (we generate changelog
entries from PRs).
- [x] Tests for the changes have been added / updated.
- [x] Documentation comments have been added / updated.
- [x] Code has been formatted via `zk fmt` and `zk lint`
  • Loading branch information
sanekmelnikov authored Aug 15, 2024
1 parent b40f3d1 commit 1696e6e
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docker-compose-cpu-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:
source: ./etc/reth/chaindata
target: /chaindata

command: node --dev --datadir /rethdata --http --http.addr 0.0.0.0 --http.port 8545 --dev.block-time 300ms --chain /chaindata/reth_config
command: node --dev --datadir /rethdata --http --http.addr 0.0.0.0 --http.port 8545 --http.corsdomain "*" --dev.block-time 300ms --chain /chaindata/reth_config
ports:
- 127.0.0.1:8545:8545

Expand Down
2 changes: 1 addition & 1 deletion docker-compose-gpu-runner-cuda-12-0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:
source: ./etc/reth/chaindata
target: /chaindata

command: node --dev --datadir /rethdata --http --http.addr 0.0.0.0 --http.port 8545 --dev.block-time 300ms --chain /chaindata/reth_config
command: node --dev --datadir /rethdata --http --http.addr 0.0.0.0 --http.port 8545 --http.corsdomain "*" --dev.block-time 300ms --chain /chaindata/reth_config
ports:
- 127.0.0.1:8545:8545

Expand Down
2 changes: 1 addition & 1 deletion docker-compose-gpu-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:
source: ./etc/reth/chaindata
target: /chaindata

command: node --dev --datadir /rethdata --http --http.addr 0.0.0.0 --http.port 8545 --dev.block-time 300ms --chain /chaindata/reth_config
command: node --dev --datadir /rethdata --http --http.addr 0.0.0.0 --http.port 8545 --http.corsdomain "*" --dev.block-time 300ms --chain /chaindata/reth_config
ports:
- 127.0.0.1:8545:8545

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:
source: ./etc/reth/chaindata
target: /chaindata

command: node --dev --datadir /rethdata --http --http.addr 0.0.0.0 --http.port 8545 --dev.block-time 300ms --chain /chaindata/reth_config
command: node --dev --datadir /rethdata --http --http.addr 0.0.0.0 --http.port 8545 --http.corsdomain "*" --dev.block-time 300ms --chain /chaindata/reth_config
ports:
- 127.0.0.1:8545:8545

Expand Down

0 comments on commit 1696e6e

Please sign in to comment.