Forum Discussion
THawesBPC_28376
May 02, 2017Nimbostratus
Modify 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...
DevBabu
May 02, 2017Cirrus
A little modification in the irule should help
when HTTP_REQUEST {
if { [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"
log local0. "http://folder.website.com$cleanpath"
}
elseif { [HTTP::uri] starts_with "/folder" && [HTTP::uri] ends_with "/folder/"} {
HTTP::redirect "http://folder.website.com"
}
}
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