Skip to content

Commit 248b39c

Browse files
committed
fix(apps/hermes): use last ip in the headers
1 parent 25a3789 commit 248b39c

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

apps/hermes/server/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/hermes/server/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "hermes"
3-
version = "0.8.5"
3+
version = "0.8.6"
44
description = "Hermes is an agent that provides Verified Prices from the Pythnet Pyth Oracle."
55
edition = "2021"
66

apps/hermes/server/src/api/ws.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,9 @@ where
189189
let requester_ip = headers
190190
.get(state.ws.requester_ip_header_name.as_str())
191191
.and_then(|value| value.to_str().ok())
192-
.and_then(|value| value.split(',').next()) // Only take the first ip if there are multiple
192+
// Only take the last ip if there are multiple. Note: if the service is behind multiple load balancers,
193+
// this will be the ip the last balancer sees.
194+
.and_then(|value| value.split(',').last())
193195
.and_then(|value| value.parse().ok());
194196

195197
ws.max_message_size(MAX_CLIENT_MESSAGE_SIZE)

0 commit comments

Comments
 (0)