Need some advice on what an iRule would look like to do this…We are moving from legacy ASP listeners to .net listeners, but we don’t want the client to change their endpoint until they are ready. So here’s what it we are looking to do:
Thanks all, I tested out each of the suggestions and it appears to be working great. One thing I wanted to do was log the original URI and the re-written URI, but I can’t seem to be able to use HTTP::URI with HTTP_RESPONSE. It’s probably something very simple…
when HTTP_REQUEST {
log local0. “OLD URI is --> [HTTP::host][HTTP::uri]”
Thanks Aaron, that is exactly what I was looking for. Michael, I tried looking at the HTTP::header location field and I wasn’t seeing the new URL in the location field, not sure if I had it correct.
I have another wrinkle with this implementation…we currently have an iRule that is looking at the old URIs and directing the traffic to a different pool based on the URI value. I have added the re-write code to the existing iRule and it seems to work, however, the string tolower funtion doesn’t appear to be working:
Actually, I have another wrinkle to add…here’s the code we’re using and what is happening. Also note I had to replace the " " with {} per a configsync issue (404 Page not found | BIG-IP Documentation)
So when a post hits /VendorABC/status.asp?.. it gets routed correctly to /Listeners/abcstatus.ashx?..
But
The next post to /VendorXYZ/status.asp?.. it gets an error becuase it’s hitting /Listeners/abcstatus.ashx?.. instead of /Listeners/xyzstatus.ashx?..
Because the asp page is named the same in both URIs, the first rule is detecting it and sending it to the wrong location. Is there a way to say when both /VendorABC/status.asp? are in the URI, direct to /Listeners/abcstatus.ashx? and when /VendorXYZ/status.asp? are in the URI, direct to /Listeners/xyzstatus.ashx?
I’m pulling my hair out with this one…Thanks in advance!
You are already most of the way there with what you need, but you were performing the same process for both of them.
The “-” on the end tells the qualifying event to perform the same action as the next event, so you need to seperate the actions for each specific HTTP::uri.
In a switch statement the values in the “” are literal, so these are detecting the first part of the URI Path do differentiate them. The -glob allows for the use of the “*” Wildcard which will match anything else after what you are looking for.
“/vendorABC/status.asp*”
“/vendorXYZ/status.asp*”
Also, in your switch statement you are performing a string to lower for the comparison, so when you are performing a string tolower make sure that the values are all in lower case so that you get a match.
Perfect, this is working exactly as we expect. Thanks so much for the explanation of the rule elements Michael, that helps to understand exactly what’s happening.
Thanks to Kevin and Aaron as well for your help, you guys all rock!