For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

sharpie_79656's avatar
sharpie_79656
Icon for Nimbostratus rankNimbostratus
Sep 10, 2013

iRule 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

  • 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]]]
            }
        }
    }