Forum Discussion
Redirects with multiple params
I'm trying to redirect the following uri and not having any success. I want to keep the second param and remove the first one.
http://domain.com/techsupport/nontemplates/Download%20Center/DownloadCenter.aspx?Download_content=User+Manuals&download_product=A660DF1A-91FF-445B-8125-CE49DF253C64
This the code I'm using. Other redirects are working fine but they have no params or only one.
when HTTP_REQUEST { set myUri [HTTP::uri] set myHost [HTTP::host] switch -glob [string tolower [HTTP::uri]] {
"/techsupport/nontemplates/Download%20Center/DownloadCenter.aspx?Download_content=User+Manuals&download_product*" { set newURI [string map -nocase {"/techsupport/nontemplates/Download%20Center/DownloadCenter.aspx?Download_content=User+Manuals&download_product=" "/Redirect/Content/User+Manuals/Product/"} [HTTP::uri]] log local0. "redirecting to http://[HTTP::host]$newURI" HTTP::redirect "http://[HTTP::host]$newURI } }
2 Replies
- nitass
Employee
the switch's string is set to lowercase but pattern is not.
e.g.
[root@ve11a:Active:In Sync] config tmsh list ltm rule myrule ltm rule myrule { when HTTP_REQUEST { switch -glob [HTTP::uri] { "/techsupport/nontemplates/Download%20Center/DownloadCenter.aspx?Download_content=User+Manuals&download_product*" { set newURI [string map -nocase {"/techsupport/nontemplates/Download%20Center/DownloadCenter.aspx?Download_content=User+Manuals&download_product=" "/Redirect/Content/User+Manuals/Product/"} [HTTP::uri]] HTTP::redirect "http://[HTTP::host]$newURI" } } } } [root@ve11a:Active:In Sync] config curl -I "http://172.28.24.10/techsupport/nontemplates/Download%20Center/DownloadCenter.aspx?Download_content=User+Manuals&download_product=A660DF1A-91FF-445B-8125-CE49DF253C64" HTTP/1.0 302 Found Location: http://172.28.24.10/Redirect/Content/User+Manuals/Product/A660DF1A-91FF-445B-8125-CE49DF253C64 Server: BigIP Connection: Keep-Alive Content-Length: 0 - jmartinez_44554
Nimbostratus
Can't believe I didn't see that. Thanks it is working now.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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