Forum Discussion
sharpie_79656
Nimbostratus
Sep 10, 2013iRule with Multiple Streams
I have an iRule that currently replaces instances of http with https found in javascript. This has been working for several months now. Recently we discovered a bug in the way a client performs a specific HTTP GET. The URI it should be requesting ends with "repor1.dat" when it should end with "report1.dat". I've modified my iRule, but it appears I am doing something wrong.
when HTTP_REQUEST {
if {[HTTP::uri] matches_regex {repor\d\.dat}}{
STREAM::expression {@repor@report@}
}
}
when STREAM_MATCHED {
log "MEDWEB Stream Match: [STREAM::match]"
}
when HTTP_RESPONSE {
STREAM::expression {@http://@https://@}
STREAM::enable
}
2 Replies
- Kevin_Stewart
Employee
You should need a STREAM expression to modify the URI. Try this:
when HTTP_REQUEST { switch -glob [string tolower [HTTP::uri]] { "*repor?.dat*" { set report_num [findstr [string tolower [HTTP::uri]] "repor" 5 ".dat"] set old_value "repor${report_num}.dat" set new_value "report${report_num}.dat" HTTP::uri [string map "$old_value $new_value" [string tolower [HTTP::uri]]] } } } - sharpie_79656
Nimbostratus
Worked like a charm. Thanks Kevin!
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