Forum Discussion
THawesBPC_28376
Nimbostratus
May 02, 2017Modify HTTP::Host and HTTP::URI in an iRule
I have a need to redirect requests from a subfolder, http://www.website.com/folder/a/b/ for example, to a subdomain of http://folder.website.com/a/b/. I am somewhat able to accomplish this but it doe...
THawesBPC_28376
Nimbostratus
May 03, 2017Thanks PK & DevBabu! You were both able to lead me to the solution. I just needed to add one additional piece to solve for website.com/folder instead of website.com/folder/
when HTTP_REQUEST {
if { [HTTP::uri] ends_with "/folder"} {
HTTP::redirect "http://folder.website.com"
}
elseif { [HTTP::uri] starts_with "/folder" && !([HTTP::uri] ends_with "/folder/")} {
set path [HTTP::uri]
set locate [string first "/" $path 1]
set cleanpath [string range $path $locate end]
HTTP::redirect "http://folder.website.com$cleanpath"
}
elseif { [HTTP::uri] starts_with "/folder" && [HTTP::uri] ends_with "/folder/"} {
HTTP::redirect "http://folder.website.com"
}
}
P_K
Altostratus
May 03, 2017What do you mean? Do you not want to use trailing slash in the uri match??
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
