Forum Discussion
hkr_36676
Nimbostratus
Mar 04, 2008Using "switch" instead of "if"
Hi
I have made this script to remove "ndk_webste" in links
on Google.
It uses a Data_Group "map_website", to make a 301 redirect.
when HTTP_REQUEST {
/ndk_we...
The_Bhattman
Nimbostratus
Mar 04, 2008I believe your code would like something like the following:
when HTTP_REQUEST {
/ndk_website/npsportal/cmsdoc.nsf/WebDoc/ndkw73fh32
$website == /npsportal $index == /cmsdoc.nsf/WebDoc/ndkw73fh32
switch -glob [HTTP::uri] {
"*ndk_website*" {
regexp {/ndk_website/[^/]+]} [HTTP:uri] website
regexp {(?:/cms)([^?]+)} [HTTP::uri] index
set redirect_map [findclass $website $::map_website " "]
HTTP::respond 301 Location "http://$redirect_map$index"
}
}
}
Also, I would try to replace the regexp because it evaluates much slower. Try looking at scan or findstr commands.
- Marc_Kozera_108Feb 01, 2007
Nimbostratus
Figured it out. So md5 on BIGIP doesnt support hex hashes, unlike TCL (-hex parameter). It will give you raw md5. I tried to convert this raw md5 to hex using binary scan H* but this was giving incorrect results.
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