Forum Discussion
agidwani_102403
Nimbostratus
Feb 25, 2008STREAM::max_matchsize - HELP - Urgent
All,
We are trying to do a URI rewrite and are running into some kind of buffer limitation with streams.
We get a error message when using the following streams directive
...
agidwani_102403
Nimbostratus
Feb 26, 2008One of the F5 expert was able to help write the script, We are running version 9.3.
Production iRule
when HTTP_REQUEST {
set uri [string tolower [HTTP::uri]]
if { ($uri contains "/global/") }
{ pool acecomm }
elseif { ($uri contains "/name1/") or
($uri contains "/name2/") or
($uri contains "/blah/")
}
{
if { $uri contains "/hscs.asmx" } {
pool acecomm
Change the URI of the request, preserving the query arguments, if any.
set args [findstr $uri "?"]
HTTP::uri "/global/hscs.asmx$args"
if {[HTTP::method] equals "POST"} {
Determine what the original path was
set origpath [findstr $uri "/" 1 "/"]
Determine the search regex (case-insensitive)
set search ""
set index 0
while {$index < [string length $origpath]} {
set char [string index $origpath $index]
set search "$search\[$char[string toupper $char]\]"
incr index
}
Look for /*/hscs.asmx and replace * with "global"
(if you change "global" here you need to change the hard-coded length of 6 below)
Note that this does not fix the Content-Length so we need to do that below
STREAM::expression "@/$search/\[Cc\]\[Oo\]\[Mm\]\[Pp\].\[Aa\]\[Ss\]\[Mm\]\[Xx\]@/global/hscs.asmx@"
STREAM::enable
Store original content-length for POST data
set origlen [HTTP::header "Content-Length"]
Assume replacement string ("global") is 6 characters long, determine difference in
length between "global" and the replacement path
set length_change [expr {6 - [string length $origpath] } ]
Set new content length, assuming the stream profile performed exactly one replacement
HTTP::header remove "Content-Length"
HTTP::header insert "Content-Length" [expr {$origlen + $length_change}]
log local0. "search path $search"
log local0. "origpath=$origpath, change=$length_change, origlen=$origlen"
log local0. "origpath=$origpath, Content len after: [HTTP::header Content-length]"
}
}
}
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
