Forum Discussion
12 Replies
- CANSTAYN569_243Nimbostratus
when HTTP_REQUEST {
if {[HTTP::uri] starts_with "/mvpvote"} {
pool Pool_Test.com:8080
}
}
So i would create a new pool that has the same servers but the port is 8080. I would redirect the requests to that pool. Also since i did not modify the full uri, you would need to change the path to content. (You would need to put it below mvpnote folder)
Regards
- denny_65237Nimbostratus
thanks ,But how to cut /mvpvote/xxxx to /xxxx
- CANSTAYN569_243Nimbostratus
As a quick solution, instead of cutting the url i would change the Path of content under iis or whatever web server you are using. I would add another folder named mvpvote
- CANSTAYN569Nimbostratus
when HTTP_REQUEST {
if {[HTTP::uri] starts_with "/mvpvote"} {
pool Pool_Test.com:8080
}
}
So i would create a new pool that has the same servers but the port is 8080. I would redirect the requests to that pool. Also since i did not modify the full uri, you would need to change the path to content. (You would need to put it below mvpnote folder)
Regards
- denny_65237Nimbostratus
thanks ,But how to cut /mvpvote/xxxx to /xxxx
- CANSTAYN569Nimbostratus
As a quick solution, instead of cutting the url i would change the Path of content under iis or whatever web server you are using. I would add another folder named mvpvote
- JinshuCirrus
Try something like below one..
when HTTP_REQUEST { if {[string tolower [HTTP::uri]] starts_with "/mvpvote"}{ set newuri [string map -nocase {"/mvpvote" ""}[HTTP::uri]] HTTP::redirect "http://[HTTP::Host]:8080$newuri" } }
-Jinshu
- The_YCirrus
Jinshu irule will work great but if you want the user to see the new url and add a redirect code then you might have to add a few things to it.
when HTTP_REQUEST { if {[string tolower [HTTP::uri]] starts_with "/mvpvote"}{ set newuri [string map -nocase {"/mvpvote" ""}[HTTP::uri]] HTTP::redirect "http://[HTTP::Host]$newuri" } }
- VernonWellsEmployee
There are two drawbacks with the use of
, in this case. Firstly, it will replaces all instances of "/mvpvote", even if it happens more than once in the path (or if you're usingstring map
, in the entire length of the Request Target). Secondly, it would replace, for example, "/mvpvote2/" with "2/".HTTP::uri
The following solution should be more correct, and as a bonus, better performing (though not tested!):
when HTTP_REQUEST { switch -glob [HTTP::path] { "/mvpvote" { HTTP::respond 301 Location "http://[HTTP::host]/[HTTP::query]" } "/mvpvote/*" { HTTP::respond 301 Location "http://[HTTP::host][substr [HTTP::uri] 8]" } } }
- denny_65237Nimbostratus
Yes,this is more exactly.thank you .I will test it.
- Vernon_97235Historic F5 Account
There are two drawbacks with the use of
, in this case. Firstly, it will replaces all instances of "/mvpvote", even if it happens more than once in the path (or if you're usingstring map
, in the entire length of the Request Target). Secondly, it would replace, for example, "/mvpvote2/" with "2/".HTTP::uri
The following solution should be more correct, and as a bonus, better performing (though not tested!):
when HTTP_REQUEST { switch -glob [HTTP::path] { "/mvpvote" { HTTP::respond 301 Location "http://[HTTP::host]/[HTTP::query]" } "/mvpvote/*" { HTTP::respond 301 Location "http://[HTTP::host][substr [HTTP::uri] 8]" } } }
- denny_65237Nimbostratus
Yes,this is more exactly.thank you .I will test it.