Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kusama - Provided Host header is not whitelisted

Tags:

substrate

having started the kusama node as a service with

polkadot --port 30333 --rpc-external --rpc-port 9933  --ws-external --ws-port 9944

Now im trying to call the node with a POST request for http://IP:9933 and this JSON payload:

{"id":1, "jsonrpc":"2.0", "method": "state_getMetadata"}

Im gettings as a 403 forbidden response:

Provided Host header is not whitelisted.

Any ideas whats missing in the setup?

like image 434
Vindberg Avatar asked Nov 02 '25 09:11

Vindberg


1 Answers

You will need to configure CORS header. You can either add --rpc-cors=all to disable origin validation or pass a allowed origin like --rpc-cors=https://your.website.url

https://github.com/paritytech/substrate/blob/fc3adc87dc806237eb7371c1d21055eea1702be0/core/cli/src/params.rs#L346

/// Specify browser Origins allowed to access the HTTP & WS RPC servers.
/// It's a comma-separated list of origins (protocol://domain or special `null` value).
/// Value of `all` will disable origin validation.
/// Default is to allow localhost, https://polkadot.js.org and https://substrate-ui.parity.io origins.
/// When running in --dev mode the default is to allow all origins.
#[structopt(long = "rpc-cors", value_name = "ORIGINS", parse(try_from_str = "parse_cors"))]
pub rpc_cors: Option<Cors>,
like image 191
Bryan Chen Avatar answered Nov 04 '25 19:11

Bryan Chen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!