Skip to content

Instantly share code, notes, and snippets.

@Wicaeed
Created October 18, 2018 18:09
Show Gist options
  • Save Wicaeed/0782841a4d444cc720f84d7f8d23420d to your computer and use it in GitHub Desktop.
Save Wicaeed/0782841a4d444cc720f84d7f8d23420d to your computer and use it in GitHub Desktop.
iRule Comparision
if { [matchclass $clientIP equals External_IP] }
{
if { ([string tolower [HTTP::uri]] starts_with "/website/account/login") } {
set qnode [string tolower [URI::query [HTTP::uri] "_node"]]
set setcookie true
} else {
set qnode ""
set setcookie false
}
if { [class match [IP::client_addr] equals CDN_IP_Addr] && [HTTP::header exists "X-Forwarded-For"] } {
# Insert a new clientIP header with X-Forwarded-For value
set clientIP [HTTP::header value "X-Forwarded-For"]
} else {
set clientIP [IP::client_addr]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment