Forum Discussion
Dodo_J_199794
Nimbostratus
May 21, 2015Replace HTTP GET URL
Dear Expert,
I want to achieve the following scenario:
A HTTP request coming to F5 (http://10.10.10.10/yo1/yo?http://youtube.com/watch?v=Di_stZgzdSw F5 replace the HTTP URL into http://youtube....
Michael_Jenkins
Cirrostratus
May 21, 2015try this (logging added so you can see what's going on in the /var/log/ltm file)
when HTTP_REQUEST {
log local0. "HOST: [HTTP::host]"
If you're only using IP, you don't need the 'string tolower' piece
switch [HTTP::host] {
"10.10.10.10" {
log local0. " URI: '[HTTP::uri]'"
"HTTP::uri" doesn't include the "?" so we need to add it when doing URI query parsing
set redir [URI::query "?[HTTP::uri]" yo]
log local0. " YO: $redir"
if { !($yo equals "") } {
log local0. " Redirecting to '$redir'"
HTTP::redirect $redir
return
}
}
}
}
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