Forum Discussion
ant77
Aug 30, 2021Cirrostratus
Persist profile using XFF to read client IP address
Hi All, Based on what we are using below, traffic to our website goes through a CDN that changes the "real" client's IP address to their proxy IP...So we can't use source-client IP persistency on ...
oguzy
Aug 31, 2021Cirrostratus
Hi ant77,
You can try below one (please do not forget to change port_number to listening port on your backend server):
when HTTP_REQUEST {
set clientip [lindex [ split [lindex [HTTP::header values X-Forwarded-For] 0] "," ] 0]
if {[HTTP::header X-Forwarded-For] != "" && $clientip equals "200.200.200.200" } then {
persist uie $clientip
node 10.10.10.11 port_number
} else {
persist uie [IP::client_addr]
pool AppServer123
}
}
https://clouddocs.f5.com/api/irules/node.html
If you also need to persistence based on XFF other than 200.200.200.200, you should modify the irule.
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