Forum Discussion
farache_28983
Sep 05, 2012Nimbostratus
Rewrite to URL and strip part of the URI
Hi guys,
Basically i need to do this.. been testing different scenarios with HTTP_request and HTTP_RESPONSE but no luck.
When a url comes through from this domain, we would like to ...
farache_28983
Sep 07, 2012Nimbostratus
Frist of all thnkas for the help
I've been trying to get this one to work but everytime this rule is giving me an error
01070151:3: Rule [/Common/persona-api_irule] error:
line 5: [string map list should have an even number of elements] [-nocase]
I've researched and seem that I need a bracket
something like this:
when HTTP_REQUEST {
log local0. "in HTTP_REQUEST"
if { ( [string tolower [HTTP::uri]] contains "/v1" ) or ( [string tolower [HTTP::uri]] contains "/v2" ) } {
set uri {string map --nocase {"/v1" "" "/v2" ""}}
HTTP::redirect "http://[HTTP::host]$uri"
}
}
But when i run that, I get an error in the browser with the following:
http://persona-api.grey.comstring%20map%20%20--nocase%20%7B%22/v1%22%20%22%22%7D
Now to make my case worst,
I have to actually redirect the traffic to specific pools depending where they are coming from --- if it is v1 , then pool a if it is v2 then pool be
I've tried changing the HTTP:redirect for a swtich command but nothing
something like this
when HTTP_REQUEST {
log local0. "in HTTP_REQUEST"
if { ( [string tolower [HTTP::uri]] contains "/v1" ) } {
set uri {string map --nocase {"/v1" ""}}
switch [string tolower "http://[HTTP::host]$uri"] {
"persona.api.grey.com" {
pool persona-api-V1_pool
}
}
}
elseif { ( [string tolower [HTTP::uri]] contains "/v2" ) } {
set uri {string map --nocase {"/v2" ""}}
switch [string tolower "http://[HTTP::host]$uri"] {
"persona.api.grey.com" {
pool persona-api-V2_pool
}
}
}
}
What am i doing wrong?
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