Forum Discussion
Greg_Carder_105
Nimbostratus
Dec 19, 2006Stream Profile - Sample?
I'm trying to do a search and replace in the response body.
I understand that a stream profile is the recommended way to do this. At least as long as the content is less than 4 MB (apparently some known issue when larger than that).
In my stream profile I have defined the target as:
@abc@xyz@123@456@
abc -> xyz and 123 -> 456
I have also created a http profile which has "rechunk" enabled so that the content length is updated after the replacements are made.
My problem is that the replacements seem to be inconsistent. Some content will be replaced and in other places it does not seem to work.
I do also have an iRule defined for this virtual server. It does some work to do some replaces on the incoming URL and the outgoing location. That part seems to work ok. I don’t do anything in the iRule related to the stream.
I have seen some examples where it seems that a stream is defined within an iRule but it seems like I should just be able to use the stream profile.
Questions:
1) Can anyone give me advice on what might be wrong? Is just defining the replaces in the stream target correct?
2) Does the stream operate on all content that is returned through the virtual server? Any known issues?
3) I was also wonder if the stream profile searches through a binary file that is written back to the browser? (i.e. A binary write of an excel file for example).
4) Is a stream profile replace case sensitive? Any way to make it case insensitive?
5) Is there a good stream profile reference that has examples? I have not been able to find one.
This is all on a HTTPS connection.
Thanks for any help!
Greg
5 Replies
- Deb_Allen_18Historic F5 AccountHi Greg -
I don't think I can answer all of your questions, but here's what I know:
1)
Defining the replacement pairs in the target string is correct for multiple replacements, however, your syntax is a bit off. It should include delimiters around source and target for each replacement pair, resulting in /2/ delimiters (plus optional whitespace) between each replacement pair, so the correct target expression would be:
@abc@xyz@ @123@456@
or
@abc@xyz@@123@456@
2)
Stream profile will operate against all returned content, but not headers. (Header/data boundary determined by protocol profiles applied to the virtual server.)
3)
Binary data would not be decoded, but if by chance the bytestream matched, a replacement would be performed.
4)
Yes, the stream profile is case sensitive, and as far as I know there is no way to modify that.
I hadn't encountered the 4MB limit you mention -- was that info provided by F5?
And one more thing: It sounds like you are using both the stream profile and other iRule functions to replace the payload. I'm not sure how the "collect/release" functions interact with the "stream" functions, but they do operate in different paradigms and some incompatibility between the 2 approaches is possible.
HTH
/deb - Greg_Carder_105
Nimbostratus
Thanks!
The missing delimeters in 1 was my problem.
The 4 MB limit was refered to in the following article:
https://tech.f5.com/home/solutions/sol6741.html
In my iRule I am just working on the headers and did not touch the body so I think I'm ok there.
Greg - Deb_Allen_18Historic F5 AccountGreat!
Thanks for the info on the Solution, I was unaware of that and I'm sure it will bite some of my customers. (I'll just point out for the benefit of those following the thread that the 4MB "limit" is a known issue, AND there is a hotfix for it -- details in the solution.)
/deb - Greg_Carder_105
Nimbostratus
Sorry, having one more issue with the replacement string in the Stream Profile.
Example:
I want to replace ".123" with ".456"
The problem I found is that the "." character seems to be a wildcard for any char. I want to escape it to actually look only for a period. After reading the TCL help on regular expressions I tried "\." but the stream profile won't save. It says the "\" is a invalid character.
Any tips for the correct way to escape a "."?
Greg - Photo_G_84660
Nimbostratus
Hi Greg,
I don't think that you can escape the "." in the stream profile because of a combination of the fact that the period is a special character, but the backslash is not. However, this iRule should give you the functionality that you want:
when HTTP_RESPONSE {
STREAM::enable
STREAM::expression @\\.123@.456@
}
Take care,
Scott H.
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
