Forum Discussion
Eric_Stuhl_2806
Nimbostratus
Apr 13, 2006Question about creating iRules
Hello,
I aplogize if this topic has been covered in the past, but I did a cursory search of the forum and couldn't find something to help me find an answer.
In my environment, we have a pair of F5 LTMs(6400s) using auto SNAT to proxy all inbound requests. One of our applications validates authentication with the source ip address of the request.
What I would like to do is to take the client_IP and place it into a cookie that could be read by my application. Is there a quick and dirty way to do this?
I would imagine something like this: (mostly blatantly stolen from codeshare)
when CLIENT_ACCEPTED {
set ckvalue [IP::client_addr]
set ckname CLIENTIP
HTTP::cookie insert name $ckname value $ckvalue
}
- Eric_Stuhl_2806
Nimbostratus
It is amazing what reading the manuals can do for you. I'm sorry for some of the silly questions. My programmers changed their requirements and now want me to tranlate IP addresses to customer names. - Colin_Walker_12Historic F5 AccountWell, the first thing I'd not is that you're missing an ending bracket on both of your matchclass lines.
when CLIENT_ACCEPTED { set ckname NETWORK_ALIAS if { [matchclass $::Alias_Subnet contains [IP::client_addr] ] } { set ckvalue ATLAS } elseif { [matchclass $::Test_Subnet contains [IP::client_addr] ] } { set ckvalue TEST } else { set ckvalue UNKNOWN } } when HTTP_REQUEST { HTTP::header insert $ckname $ckvalue }
- Eric_Stuhl_2806
Nimbostratus
I think that did it for me. Thanks for all the help. - Eric_Stuhl_2806
Nimbostratus
I'm back.
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