Forum Discussion
jrosales2000_10
Apr 29, 2011Nimbostratus
What did i do wrong with this irule for redirection based on url
Hi, i am trying to accomplish the following (we are running LTM 1600's version 9.4.6):
If a user enters url: oem1.website.com they are routed to oem1.website.com/oem1/vin.aspx
If a user enters url: oem2.website.com they are routed to oem2.website.com/oem2/vin.aspx
There is one Virtual Server (and one website in IIS) that serves the content for both of these oem's, however, based on the url entered, i want them each to go to their correct subfolder that contains pages that are skinned for their particular oem.
I have tried using the following irule:
when HTTP_REQUEST {
if {[string tolower [HTTP::host]] eq "oem1.website.com" } {
HTTP::uri "/oem1/vin.aspx"
}
if {[string tolower [HTTP::host]] eq "oem2.website.com" } {
HTTP::uri "/oem2/vin.aspx"
}
}
The problem i am having is that no matter what the user enters for a complete url (ie - oem1.website.com/oem1/images/image.jpg) it is routing the user back to that /oem1/vin.aspx.
On my initial shot at the irule, i wanted to have the irule work for all environments, (dev.oem1.website.com, qatest.oem1.website.com, etc), so in place of the EQUALS above, i used CONTAINS. I figured this is what was causing all traffic containing the url to be routed to the vin.aspx page. I thought maybe changing it to EQUALS would allow the rest of the traffic to flow appropriately, but it isn't working, so i didn't do something correctly.
I don't use irules too much, (i gleaned what i do know from these forums) :), any help would be appreciated! If i am off base on my approach, and you think another method would work better, i am open to suggestions!
Thanks!
Jodie
Edited to change equals to eq and to note that it is just one virtual server.
- Michael_YatesNimbostratusTry this modification with some logging enabled and let us know what the results are.
when HTTP_REQUEST { log local0. "Incoming URL - HOST:[HTTP::host] URI:[HTTP::uri] Check if the request is for the root document if {[HTTP::path] eq "/" } { switch [string tolower [HTTP::host]] { "devsmk.landrover.ourwebsite.com" { HTTP::uri "/landrover/vin.aspx" } "devsmk.jaguar.ourwebsit.com" { HTTP::uri "/jag/vin.aspx" } } } switch -glob [ string tolower [HTTP::uri]] { log local0. "URI Compare - URI:[HTTP::uri]" "/jag*" { pool pool.containing.jag.files } } }
- jrosales2000_10NimbostratusHi, i wanted to follow up with a resolution on this issue (they are still qa'ing, but an initial smoketest looks good).
- Michael_YatesNimbostratusGlad we could help you get your problem resolved.
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