Forum Discussion
AngryCat_52750
Nimbostratus
Oct 24, 2013iRule to a variable for chosen pool member
currently in our dev and qa environments, we have an iRule that staticly replaces a header for an application.. we can do it this way coz we only have one member in a pool..
when ACCESS_ACL_ALLOWE...
AngryCat_52750
Nimbostratus
Oct 24, 2013i have more code in the when ACCESS_ACL_ALLOWED.. i am wondering i can move it all to the HTTP_REQUEST_SEND event..
what we have now
when ACCESS_ACL_ALLOWED {
set user [ACCESS::session data get "session.logon.last.username"]
set uri [string range [HTTP::uri] 3 end]
HTTP::header replace "APP_USER" $user
HTTP::header replace Host "server1.domain.com:8080"
HTTP::uri $uri
}
when HTTP_RESPONSE {
if { [HTTP::header "Location"] contains "server1" } {
HTTP::header replace Location [string map {"server1.domain.com:8080" "app.example.com/app"} [HTTP::header value Location]] }}
What i think we need.
when HTTP_REQUEST_SEND {
if { [class match [LB::server addr] equals prod_servers] } {
serverside {
set user [ACCESS::session data get "session.logon.last.username"]
set uri [string range [HTTP::uri] 3 end]
HTTP::header replace "APP_USER" $user
HTTP::header replace Host "[class match -value [LB::server addr] equals prod_servers]:8900"
HTTP::uri $uri
}
}
}
when HTTP_RESPONSE {
if { [HTTP::header "Location"] starts_with "prodserver" } {
HTTP::header replace Location [string map {"[class match -value [LB::server addr] equals prod_servers]:8080" "prod_app.example.com/app"} [HTTP::header value Location]] }
}What do you think??
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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