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.com/watch?v=Di_stZgzdSw
I created the following but doesn't seems working.
WHEN HTTP_Request {
if {[string tolower [HTTP::host]] starts_with “10.10.10.10”} {
set Original_URL [URI::query [HTTP::uri]]
set Original_URL2 [HTTP::query]
HTTP::request replace $Original_URL2
pool Server-10
}
}
Any advise?
Thanks.
1 Reply
- Michael_Jenkins
Cirrostratus
try 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