diff --git a/prdoc/pr_6454.prdoc b/prdoc/pr_6454.prdoc new file mode 100644 index 000000000000..3fd3e39db604 --- /dev/null +++ b/prdoc/pr_6454.prdoc @@ -0,0 +1,7 @@ +title: 'rpc server: fix ipv6 host filter for localhost' +doc: +- audience: Node Operator + description: "This PR fixes that ipv6 connections to localhost was faulty rejected by the host filter because only [::1] was allowed" +crates: +- name: sc-rpc-server + bump: minor diff --git a/substrate/client/rpc-servers/src/utils.rs b/substrate/client/rpc-servers/src/utils.rs index d9d943c7c1fb..a3cb8afcb258 100644 --- a/substrate/client/rpc-servers/src/utils.rs +++ b/substrate/client/rpc-servers/src/utils.rs @@ -39,8 +39,18 @@ pub(crate) fn host_filtering(enabled: bool, addr: Option) -> Option< if enabled { // NOTE: The listening addresses are whitelisted by default. +<<<<<<< HEAD let hosts = [format!("localhost:{port}"), format!("127.0.0.1:{port}"), format!("[::1]:{port}")]; +======= + + let hosts = [ + format!("localhost:{}", addr.port()), + format!("127.0.0.1:{}", addr.port()), + format!("[::1]:{}", addr.port()), + ]; + +>>>>>>> 0a0af0e (rpc server: fix host filter for localhost on ipv6 (#6454)) Some(HostFilterLayer::new(hosts).expect("Valid hosts; qed")) } else { None