Forum Discussion
- Ed_Hammond_2611NimbostratusTry something like:
regsub {^([^\.]*).} [HTTP::host] {${1}2.} newhost log local0. "[HTTP:host] $newhost"
- Colin_Walker_12Historic F5 AccountWhile regsub would technically work, it's going to induce a lot of overhead. There are lots of other ways to go about that: scan, string map, etc.
- hooleylistCirrostratusI think something like this should work:
switch [string tolower [HTTP::host]] { "cjj.com" { HTTP::header replace Host "cjj2.com" } default { HTTP::header replace Host "[getfield [HTTP::host] "cjj2.com" 1]2.cjj.com" } }
- Robert_47833AltostratusHi,all friends,I use irule below to achieve this:
- Colin_Walker_12Historic F5 AccountI'm glad to see that you got it working. Bonus points for using the scan command, very cool and efficient. ;)
- Robert_47833Altostratushaha,thanks,I have learned a lot from here
- Robert_47833AltostratusHi,by the way,do u know why I can't add number "2" in HTTP::redirect "http://$domainfirst2$domainleft[HTTP::uri],how to achieve this?
- Colin_Walker_12Historic F5 AccountIt's not working because it doesn't know where the first variable stops, and is trying to incorporate the 2 as part of the variable name.
% set h1 www.srwd www.srwd % set h2 9.com 9.com % puts $h1$h2 www.srwd9.com % puts $h12$h2 can't read "h12": no such variable % puts ${h1}2${h2} www.srwd29.com %
- Robert_47833Altostratusoh,Colin