Forum Discussion
yves_werniers_1
Nimbostratus
Jun 08, 2010irule stream::exporession and data group list
Hello,
I would like to rewrite responses from webservers to add a part to the url (in certain cases). Is it possible to use the stream::expression with data group lists? Like that, I could make a list for the source, and one for the target. The content of those lists would include things like
href="/asia/
so with only one double quote
If I just use a stream profile with those entries, it works. But the traget field would probably become too long if I had to put all strings in there.
I have tried something like
when HTTP_RESPONSE {
set stream_expression "@$::test_in@$::test_out@"
STREAM::expression $stream_expression
STREAM::enable
}
where test_in and test_out are data group lists
that does not work
any suggestions?
- hoolio
Cirrostratus
Hi Yves, - yves_werniers_1
Nimbostratus
Hi Aaron, - yves_werniers_1
Nimbostratus
Would it be an option to loop through the list crteated by the get class list_in ? - The_Bhattman
Nimbostratus
Hi yves, - yves_werniers_1
Nimbostratus
For the moment, I have this: - Another option would be to store the expressions each as a single entry in the string data group
class stream_expressions { { "@five@six@" "@nine@ten@" "@one@two@" "@seven@eight@" "@three@four@" } }
set expressions [class get stream_expressions] set se "" foreach {re} $expressions { append se [lindex $re 0] } if { [llength se] > 0 } { STREAM::expression $se; } else { STREAM::disable; } }
class stream_expressions { "@one@two@@three@four@@five@six@@seven@eight@@nine@ten@" }
set se [lindex [class element 0 stream_expressions] 0]; if { [llength se] > 0 } { STREAM::expression $se; } else { STREAM::disable; } }
- yves_werniers_1
Nimbostratus
Joe, - hoolio
Cirrostratus
You should be able to escape the double quotes with backslashes, or just use curly braces to force literal interpretation of the double quotes: - yves_werniers_1
Nimbostratus
Hello all,when HTTP_RESPONSE { set listlengte [llength [class get testin]] set streamexpression "" foreach {stringin} [class get testin] {stringout} [class get testout] { set streamexpression [concat $streamexpression "@[lindex $stringin 1]@[lindex $stringout 1]@"] } set streamexpression [string map {"@ @" "@@"} $streamexpression] STREAM::expression $streamexpression STREAM::enable }
when HTTP_REQUEST { Don't allow data to be chunked if { [HTTP::version] eq "1.1" } { if { [HTTP::header is_keepalive] } { HTTP::header replace "Connection" "Keep-Alive" } HTTP::version "1.0" } }
- hoolio
Cirrostratus
The most efficient option would be to hard code the stream expression in the iRule. Are you expecting to need to change the search/replace strings often enough to justify the overhead in creating it on every TCP connection or HTTP request/response?
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