Forum Discussion
irule not appending IP
Have the following irule for appending IP address to uri on incoming requests. login and login2 append IP address as expected, ACCGateway in uri is not appending IP address as expected.
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri]] {
"*login.aspx" -
"*login2.aspx" -
"*ACCGateway.aspx" {
HTTP::uri "[HTTP::uri]?IPAddress=[getfield [IP::client_addr] % 1]"
}
"*login.aspx\?*" -
"*login2.aspx\?*" -
"*ACCGateway\?*" {
HTTP::uri "[HTTP::uri]&IPAddress=[getfield [IP::client_addr] % 1]"
}
}
}
3 Replies
- hoolio
Cirrostratus
Make sure to put your switch cases in lowercase as you're setting the URI to lowercase for the switch comparison.
Aaron - Tom_89796
Nimbostratus
OK, so changing it to the below, but it is still not appending the IP address as expected. The get request conatins this directly - /ACC/ACCGateway.aspx?
I tried adding .aspx to the second entry of accgateway as well with no luck so far. I believe that .aspx should be there?
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri]] {
"*login.aspx" -
"*login2.aspx" -
"*accgateway.aspx" {
HTTP::uri "[HTTP::uri]?IPAddress=[getfield [IP::client_addr] % 1]"
}
"*login.aspx\?*" -
"*login2.aspx\?*" -
"*accgateway.aspx\?*" {
HTTP::uri "[HTTP::uri]&IPAddress=[getfield [IP::client_addr] % 1]"
}
}
} - Tom_89796
Nimbostratus
actaully looks like it worked with the change to lower case in the compare. Just didn't wait long enough, must have been cached in my browser
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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