Forum Discussion
BigIP_Support_9
Nimbostratus
Nov 17, 2005forward URI with manipulation
We have an application with several modules for each dept. Each module is handled by a dedicated server. The application use URI to identify the module:
http://www.abc.com/sales/func1/index.jsp (w...
Nov 17, 2005
Ok, you didn't mention that you needed the directory truncated if there wasn't a second slash. My previous example assumed that if there was only one directory, then it would remain.
Here's some code that should do the trick
when HTTP_REQUEST {
set idx [string first {/} [HTTP::uri] 1]
if { $idx != -1 } {
set sub_uri [string range [HTTP::uri] $idx end]
} else {
set sub_uri {/}
}
...
HTTP::uri $sub_uri
}
This should result in the following transformations
/foo -> /
/foo/ -> /
/foo/bar -> /bar
/foo/bar.html -> /bar.html
Now, if you need to modify the response content to "re-add" your prefixes, we've covered this before. Check out my iRules entries on my blog
http://devcentral.f5.com/weblogs/joe/category/27.aspx?Show=All
Click here
Check out the "modify uri and rewrite" entry. I think that has what you are looking for.
Also, with 9.2 you can use the stream profile to accomplish the same thing in a more efficient manner.
-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