fix for XFF behind haproxy with single listener :::443 v4v6

pull/19/head
Niko PLP 2 years ago
parent d23e6a79aa
commit 04df0b5488
  1. 5
      p2p-broker/src/server_ws.rs

@ -111,9 +111,12 @@ fn check_xff_is_public_or_private(
} }
} }
Some(val) => { Some(val) => {
let ip_str = val let mut ip_str = val
.to_str() .to_str()
.map_err(|_| make_error(StatusCode::FORBIDDEN))?; .map_err(|_| make_error(StatusCode::FORBIDDEN))?;
if ip_str.starts_with("::ffff:") {
ip_str = ip_str.strip_prefix("::ffff:").unwrap();
}
let ip: IpAddr = ip_str let ip: IpAddr = ip_str
.parse() .parse()
.map_err(|_| make_error(StatusCode::FORBIDDEN))?; .map_err(|_| make_error(StatusCode::FORBIDDEN))?;

Loading…
Cancel
Save