Forum Discussion
CraigyB_172365
Nimbostratus
Jan 12, 2018HOST and partial path rewrite
Hi I am new to F5 and am trying to do a URL rewrite a chunk of the URL. I think I am on the right track but I just cannot make it work. Any help is really appreciated.
I just want to replace any...
Lee_Sutcliffe
Nacreous
Jan 12, 2018You can try this iRule - I've written it without the redirect as I presume you want to rewrite the header and URI on the fly - a redirect to a private IP may cause issues if accessing over the internet? Please correct me if not. I've also rewritten the host header using the selected back-end server IP and port you connect to, rather than hard code the IP addresses - this can be changed if needs be Let me know how you get on
when HTTP_REQUEST {
if {[HTTP::uri] starts_with "/info"} {
set newUri [string map [list "info" "files"] [HTTP::uri]]
HTTP::header replace Host "[LB::server addr]:[LB::server port]"
HTTP::uri $newUri
}
}Cheers Lee
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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