Forum Discussion
redirects with * on the end....not working
basic redirect with a twist. I thought my little * symbol would mean ANYTHING after the =, no matter what, redirect to the new site...but it doesnt. im looking into maybe needing a single quote around it or something. Ill be off reading about tcl and wildcards. any tips would be appreciated.
"ecms.epa.gov/erma/login.htm?action=search&token=*" { HTTP::redirect "https://ecms.epa.gov/erma2/login.htm?action=search" }
Thanks!
Dave
5 Replies
- nrg2brn_163859
Nimbostratus
...it works if I remove the star..... - Josh_B_152229
Nimbostratus
Is globbing enabled? Are you checking specifically for the URI? Something like this should work:
switch -glob [string tolower [HTTP::uri]] { "/erma/login.htm?action=search&token=*" { HTTP::redirect "https://ecms.epa.gov/erma2/login.htm?action=search" } default { do something else } } - StephanManthey
Nacreous
Hi,
the "starts_with" comparison should do the job:when HTTP_REQUEST { if {[string tolower [HTTP::uri] starts_with "/erma/login.htm?action=search&token="} { HTTP::redirect "https://ecms.epa.gov/erma2/login.htm?action=search" } }Please keep in mind, that query parameters in different order will break the logic.
With
and[HTTP::path]
you have access to the URI components. Use[HTTP::query]
to be case insensitive. Thanks, Stephan[string tolower ] - nrg2brn_163859
Nimbostratus
Thanks, guys. I decided to go with glob because I was already using a switch statement, and it did in fact work, so that is great. Now im getting questions on why it worked, and frankly, I dont have a clear answer. It seems the glob command reads a filename more directly. not really sure. any explanations on why this worked??
anyway, the important thing is the site redirects now, thanks so much for both solutions.
dave
- Arie
Altostratus
as a standalone command in Tcl is somewhat different thanglob
as an option to-glob
.switchSwitchhttps://www.tcl.tk/man/tcl/TclCmd/switch.htm (see
for a more detailed description: https://www.tcl.tk/man/tcl/TclCmd/string.htm)string matchglob
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