Forum Discussion
Ruggerfly1
May 03, 2018Nimbostratus
IRULE to Set APM Session variable for X-Forwarded-For
Good Afternoon,
I have a Network that connects to a VIP and all addresses are NAT'd behind the same IP. They are using a X-Forwarded-For in the Header. I'd like to set an APM Session Variable ...
Stanislas_Piro2
May 04, 2018Cumulonimbus
You can get the XFF header in ACCESS_SESSION_STARTED event, and evaluate the value in the irule.
when ACCESS_SESSION_STARTED {
set xforwardedfor [HTTP::header values {X-Forwarded-For}]
ACCESS::session data set session.custom.xforwardedfor $xforwardedfor
switch $xforwardedfor {
"1.1.1.1" -
"2.2.2.2" -
"3.3.3.3" {
ACCESS::session data set session.custom.xff_known_ip 1
}
default {
ACCESS::session data set session.custom.xff_known_ip 0
}
}
}
Then check the value in the empty box
expr { [mcget {session.custom.xff_known_ip}] == 1 }
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects