Forum Discussion
jacob900_39797
Nimbostratus
Mar 12, 2007URL-uri rewrite problem using Default
Hello,
I am trying to write a simple rule that has worked before in similar circumstances. I need the rule to behave so as three outcomes can take place"
1) If someone types in web.mysite.com that the LTM appends the "/specific" uri.
2) If someone types in web.mysite.com/specific that they go right on to the correct pool
3) If the user types any other misc uri, ie: /whatever, that it redirects/replaces it with the right URL-uri syntax so they can make it to the right pool.
In the rule below, whenever I try to use the "default" option it does redirect them but it strips the jpegs from the page..???? Any ideas on why it is doing this and what a proper rule would look like.
when HTTP_REQUEST {
switch [string tolower [HTTP::uri]] {
"/reaaccom/" {
pool Reaaccom_YGB_80 }
"/" {
HTTP::redirect http://[HTTP::host]/specific/ }
default {
HTTP::redirect http://[HTTP::host]/specific/ }
}
}
///////////////////////////////////////////
I was also trying a rule something along these lines that covers items 1 and 2 but couldn't figure out the wildcard problem described in 3.
when HTTP_REQUEST {
if { [HTTP::uri] == "" || [HTTP::uri] == "/" } {
HTTP::redirect http://[HTTP::host]/specific/
Any input would be highly appreciated.
- hoolio
Cirrostratus
It sounds like the images for the web app aren't under the /specific directory, so when a client makes a request for an image, they're getting redirected to /specific instead of getting the image. What is the path for images? - jacob900_39797
Nimbostratus
I actually started out using the -glob switch but it came up with the same results. Here is my rule again..as of right now with the -glob switch again. - A few comments.
when HTTP_REQUEST { switch [string tolower [HTTP::uri]] { "/specific/" { pool Specific_Pool_80 } default { HTTP::redirect http://[HTTP::host]/specific/ } } }
http://www.foo.com/index.html -> http://www.foo.com/specific/
when HTTP_REQUEST { switch -glob [string tolower [HTTP::uri]] { "/specific/*" { pool Specific_Pool_80 } default { HTTP::redirect http://[HTTP::host]/specific[HTTP::uri] } } }
http://www.foo.com/index.html -> http://www.foo.com/specific/index.html
- jacob900_39797
Nimbostratus
I apprecaite you clearing up how the default works. I am new to these iRules so I am in newbie stage right now. I wanted to explain once more about what I am trying to accomlish. - jacob900_39797
Nimbostratus
Joe,
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