Forum Discussion
STREAM Expression with exceptions
Hi all,
In my HTTP page (including form), i want to replace a string domain.com to domainservice.com But i don't want to change if string is @domain.com.
I tried with multiple expressions with no luck
Can some one help me on this
Thanks
5 Replies
- shaggy
Nimbostratus
are you using the stream profile or stream profile + iRule to apply your stream patterns?
- StephanManthey
Nacreous
Hi Narendra,
in case you are using iRules the following will hopefully work for you as well:when HTTP_RESPONSE { STREAM::expression "\[^@\]comain\.comdomainservice\.com" STREAM::enable }Thanks, Stephan
- giltjr
Nimbostratus
You might be able to use a "null" stream match along with STREAM_MATCHED event.
Look at: https://devcentral.f5.com/wiki/iRules.parse_username_from_http_requests_rule.ashx
I don't know exactly how stream works, that is does it "rescan" a string after it has found and done a a replace. Could you specify a second like:
"domain\.comdomainservice\.com \@domainservice\.com\@domain.com"Not sure if you have to escape and @ sign.
- JG
Cumulonimbus
Try this:
when HTTP_REQUEST { Disable the stream filter for all requests STREAM::disable LTM does not uncompress response content, so if the server has compression enabled and it cannot be disabled on the server, we can prevent the server from sending a compressed response by removing the compression offerings from the client HTTP::header remove "Accept-Encoding" } when HTTP_RESPONSE { STREAM::expression "@domain\.com domain\.comdomainservice.com" STREAM::enable } when STREAM_MATCHED { set matched_string [string tolower [STREAM::match]] if {$matched_string starts_with "@domain.com"} { STREAM::replace return } } - StephanManthey
Nacreous
Hi again,
the following approach seems to work.
It seems to follow a longest match approach.
So the order of pattern mappings does not matter.
when HTTP_REQUEST { STREAM::disable } when HTTP_RESPONSE { STREAM::expression {@domain\.com@domain.com domain\.comdomainservice.com} STREAM::enable }Tested on v11.5.1HF8.
Thanks, Stephan
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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