Forum Discussion
KimiLi_147173
Nov 27, 2017Nimbostratus
Want to rewrite part of host
Hi guys, I'm still new to iRules, I wonder that if it is possible that an iRule can rewrite part of the host instead of all of it.
I mean like, if a client request a host like "123.aaa.com/888/"...
- Nov 28, 2017
If string position is known then you can use
function to grep value like below.getfield
set hostname [getfield [HTTP::host] "." 1] If the URL is xxx.aaa.bbb.com, then getfield command will grep value of 1st position xxx set hostname1 [getfield [HTTP::host] "." 2] If the URL is xxx.aaa.bbb.com, then getfield command will grep value of 2nd position aaa
Refer below link. Hope it will be helpful.
boneyard
Nov 27, 2017MVP
yes, you can pretty much do everything on that. all, a part, multiple parts, nothing :)
check the documentation on a string manipulation: https://devcentral.f5.com/articles/the101-irules-101-string-handling-and-manipulation
https://devcentral.f5.com/articles/irules-101-13-tcl-string-commands-part-1
it is just a matter of writing the code to do what you want.
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