Forum Discussion
paulhaskew_7063
Nimbostratus
Jun 24, 2009Rewrite portion of URI?
Hi everyone. First off this forum/website has been invaluable for finding information and answering my questions for quite some time. Wonderful!
So to my question, I have a particular site that we are accessing via http://sub.domain.com/culture/someservice/partners/?qs=*.
The problem I have is that the actual site lives on on http://sub.domain.com/culture/someservice.svc/partners/?qs=*.
The devs would like the flexability to be able to rewrite a portion of the URI dynamically when its requested from multiple cultures. The culture strings could be, en-US, en-GB, nl-NL, etc etc.
Here is the current iRule I wrote to simple just redirect the traffic based on what is contained within the URI, but how to setup the dynamic replace escapes me.
when HTTP_REQUEST {
if {([string tolower [HTTP::uri]] contains "someservice") } {
pool my_secondary_pool
} else {
pool my_first_pool
}
log local0. "Request: [HTTP::uri]"
}
I have looked at the stream command and tried HTTP::header but alas I admit defeat.
Any help would be greatly appricated.
- L4L7_53191
Nimbostratus
To make sure I understand this: The BigIP will see a header named "URI" with a value like 'en-US' or 'en-GB', or with a value like 'syndicate.en-GB'? - paulhaskew_7063
Nimbostratus
Matt, - L4L7_53191
Nimbostratus
Gotcha. So how do I know what service a user is coming from? Are you using the Accept-Language header to determine the ultimate service destination? - paulhaskew_7063
Nimbostratus
Not entirely sure how the devs are doing the culture work, that portion is coded in C and using II6. The culture request could change at any time really. Is there a way to deal with that start and ending portion of the URI with a wild card? - hoolio
Cirrostratus
What we are trying to do is dynamically replace the word someservice with someservice.svc in the URI string.
when HTTP_REQUEST { Replace someservice with someservice.svc in the path of the request. Leave everything else in the path intact. HTTP::path [string map -nocase {someservice someservice.svc} [HTTP::path]] log local0. "[IP::client_addr]:[TCP::client_port]: Rewrote [HTTP::path] to\ [string map -nocase {someservice someservice.svc} [HTTP::path]]" }
- paulhaskew_7063
Nimbostratus
rock on, thanks man, I will give this a go. :D
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