Troubleshoot iRule for HTTP header rewrite
I am not a iRule expert 🙂
What the client wants is that, if the client browse https://cv89ppen.hrms.com, it will be forwarded to cv99pp.hrms.com/psp/CV89PP/?&cmd=login&languageCd=ENG.
or if the client browse https://cv89ppfr.hrms.com, it will be forwarded to cv99pp.hrms.com/psp/CV89PP/?&cmd=login&languageCd=CFR.
or if the client browse cv89pp.hrms.com, it will simply append "/CV89PP/signon.html".
The virtual server does the SSL offloading.
For any reason, only the append part worked. Nothing happened when client browse https://cv89ppen.hrms.com/ and https://cv89ppfr.hrms.com, and it even won't leave the logging information.
Can anybody take a look? Below is my iRule.
Thanks.
====================================================================================
when HTTP_REQUEST {
log local0. "Client [IP::client_addr] is accessing [HTTP::host][HTTP::uri]"
if {[HTTP::uri] equals "/"} {
switch -glob {string tolower [HTTP::host]} {
"cv89ppen.hrms.com" {
HTTP::header replace Host "cv99pp.hrms.com"
HTTP::uri "/psp/CV89PP/?&cmd=login&languageCd=ENG"
log local0. "Client [IP::client_addr] is redirected to [HTTP::host][HTTP::uri]"
}
"cv89ppfr.hrms.com" {
HTTP::header replace Host "cv99pp.hrms.com"
HTTP::uri "/psp/CV89PP/?&cmd=login&languageCd=CFR"
log local0. "Client [IP::client_addr] is redirected to [HTTP::host][HTTP::uri]"
}
"cv89pp.hrms.com" {
HTTP::uri "/CV89PP/signon.html"
}
}
}
}