Riaz_125436
Mar 13, 2015Nimbostratus
iRule - http redirect and x-forward
Hi folks,
I need help to check if my iRule on LTM A (external) is redirecting the traffic to LTM B VIP correctly and iRule on LTM B will help keep the users host and uri and display the page on the servers.
LTM A (External):
-------------------------------
VS: vs_abc_com_test
Destination IP: Public IP:80
Pool: pool_efg
Member: 10.10.30.30
iRule on VS:
"abc.com" {
if { [HTTP::uri] starts_with "/test"} {
pool pool_abc_test
snat automap
}
else {
HTTP::redirect "https://abc.com[HTTP::uri]"
}
}
Pool in iRule: pool_abc_test
Member: 10.10.10.1 ----------------- which is the VIP on LTM B
LTM B (Internal):
-----------------------------
VS: vs_pool_abc2_test2
Dest IP: 10.10.10.1
Pool: pool_abc2_test2
Members:
20.20.20.1:80
20.20.20.2:80
iRule on VS:
when HTTP_REQUEST {
if { ([HTTP::uri] contains "/xyz/login.aspx") || ([HTTP::uri] contains "/uvw/login.aspx")}{
if {not [HTTP::header exists "X-Forwarded-For"]} {
HTTP::header insert X-Forwarded-For [IP::client_addr]
}
}
}