Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to change listen-addr for RPC #2743

Open
dancamarg0 opened this issue Apr 30, 2024 · 3 comments
Open

Unable to change listen-addr for RPC #2743

dancamarg0 opened this issue Apr 30, 2024 · 3 comments

Comments

@dancamarg0
Copy link

dancamarg0 commented Apr 30, 2024

Describe the bug

I'm able to change all the listen addresses below:

  --listen-addr /ip4/<IP_ADDR>/tcp/9933/ws \
  --listen-addr /ip4/<IP_ADDR>/tcp/9933/http \
  --listen-addr /ip4/0.0.0.0/tcp/30334 \
  --listen-addr /ip4/0.0.0.0/tcp/30333 \
  --listen-addr /ip6/::/tcp/30334 \
  --listen-addr /ip6/::/tcp/30333 \

I can access ws as expected from port 9933 but I cannot access the RPC API

For example the following RPC call doesn't work because I'm unable to connect to the server

curl http://<IP_ADDR>:9933 -X POST -H 'Content-Type: application/json' -d '
{"jsonrpc":"2.0","method":"system_health","params":[],"id":0}'

Expected Behavior

I should be able to open and query the RPC API via private IP + 9933 when provided --listen-addr /ip4/<IP_ADDR>/tcp/9933/http (If I'm passing the wrong protocol string please advise)

If I don't provide any listen-addr argument and just use the defaults from --rpc-port it works otherwise and I can see this message on startup: Running JSON-RPC server: addr=0.0.0.0:9933, allowed origins=["*"]

Current Behavior

Steps to Reproduce

  1. Running acala v2.24.0
  2. Try to bind RPC to a private IP instead of default 0.0.0.0, you can use 127.0.0.1 for example
  3. RPC + WS should work

Additional context

  • Node version:
  • OS:
  • Command line options:
  • Relevant transaction hash:
  • Relevant account address:
  • Logs. Please format it as code blocks
@dancamarg0
Copy link
Author

This is a required feature for some RPC providers, because we want to bind the service just to our private network so we can be compliant to our security measures

@xlc
Copy link
Member

xlc commented Apr 30, 2024

--listen-addr is for the libp2p protocol

Unfortunately polkadot-sdk doesn't appear to offer such functionality. I have reported this issue paritytech/polkadot-sdk#4331

A workaround is to have --rpc-external=false so that it binds to localhost and use subway to proxy the requests. It is possible to config listen address with subway. https://github.com/AcalaNetwork/subway/blob/7cb7c73ab08d53b8c3b181e52acb5d227a5b23a5/configs/config.yml#L26

@niklasad1
Copy link

This should be fixed once acala updates to polkadot-stable2409

See paritytech/polkadot-sdk#5508 for further information how to use it and whether you want some other features before making it "non-experimental"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants