Forum Discussion
Emre_27149
May 09, 2011Nimbostratus
irule redirection issue
Hi,
Incoming client requests to http://xyz.com.tr - (10.x.x.199) distrubutes to the pool httpgw-8086-pool but I want to change the URI when the clinet requests load balanced (exmp: 10.x.x.257:8086/httpgw) . I have wrote the below irules to accomplish my goal but it did not work.How can I direct the client requests to the pool as . Thank you."
pool httpgw-8086-pool {
monitor all tcp
members {
10.x.x.157:8086 {}
10.x.x.158:8086 {
session user disabled
}
}
rule httpgw-irule {
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] equals "/" } {
HTTP::uri [string map -nocase {"/" "/httpgw"} [HTTP::uri]]
}
}
}
rule httpgw-irule-alternate {
when HTTP_REQUEST {
if { [HTTP::uri] equals "/" }
{ set newuri "/httpgw"
log "Incoming uri - [HTTP::uri] being translated to $newuri"
HTTP::uri $newuri
}
}
}
rule httpgw-redirection {
when HTTP_REQUEST {
if { (([HTTP::host] equals "xyz.com.tr") and ([HTTP::uri] equals "/")) }{
HTTP::redirect "http://xyz.com.tr/httpgw"
}
}
}
virtual httpgw-8086-VIP {
pool httpgw-8086-pool
destination 10.x.x.199:http
ip protocol tcp
rules httpgw-irule-alternate
persist source_addr
profiles {
http {}
tcp-lan-optimized {
clientside
} tcp-wan-optimized {
serverside
}
}
}
- Michael_YatesNimbostratusThe iRule that you have written will mask the URI to the user and send the modified URI to the server.
when HTTP_REQUEST { if { [HTTP::uri] equals "/" } { set newuri "/httpgw" log "Incoming uri - [HTTP::uri] being translated to $newuri" HTTP::uri $newuri HTTP::redirect $newuri } }
- Emre_27149NimbostratusHi Michael,
- Michael_YatesNimbostratusYou can specify a specific Node and Port with the node command.
- Emre_27149NimbostratusHi Michael,
- Emre_27149NimbostratusHi Micheal
- Michael_YatesNimbostratusYes I believe that you can, but you would need to further refine the iRule and build the destination in the HTTP::redirect event.
- Emre_27149NimbostratusHi Michael,
- hooleylistCirrostratusIf you want to rewrite the host header based on the selected pool member IP and/or port, you can use the HTTP_REQUEST_SEND event. Here is a 9.4.x example which you could modify to use the class command for 10.x:
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