Forum Discussion
Move [HTTP::host] field to path
Hi,
I am trying to do the following:
Inbound to F5 - https://customer.f5.com/ Re-write to - https://f5.com/customer
Where "customer" could be any potential customer.
I have started the rule like this:
when HTTP_REQUEST { set customer [getfield [HTTP::host] "." 1] if { [HTTP::host] contains $customer } { }
Then became a bit stuck. As I essentially need to remove the field, and then add it as a path.
I'm guessing as well that there might be more to the path than just that, more paths etc, so might essentially need to wildcard the end.
Many thanks for any help.
2 Replies
Hi Therob152,
try the iRule below...
when HTTP_REQUEST { if { [string tolower [HTTP::host]] ends_with ".f5.com" } then { HTTP::uri "/[getfield [HTTP::host] "." 1][HTTP::uri]" HTTP::host [domain [HTTP::host] 2] } log local0.debug "New URL is: https://[HTTP::host][HTTP::uri]" }Cheers, Kai
- crodriguezRet. Employee
How about something like this to start with:
when HTTP_REQUEST { set hlq [getfield [HTTP::host] ".f5.com" 1] HTTP::path "/$hlq[HTTP::path]" HTTP::host "f5.com" }You can wrap whatever conditional logic you need around it.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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