Forum Discussion
Excluding some urls for the STREAM conversion
However, when the page contains calls to google.com, amazon.com, ebay.com it tries to put SSL on it.
Is there any way to include an exception list like the one that we have for the internal_net?
when HTTP_RESPONSE {
if { not ([matchclass [IP::client_addr] equals $::internal_net])}{
Enable debug logging to /var/log/ltm? 1=yes, 0=no
set debug 1
If the response content type is text, configure the default stream profile to replace http:// with https://
if {[string tolower [HTTP::header value Content-Type]] contains "text"}{
STREAM::expression @http://@https://@
STREAM::enable
}
Check if the response is a redirect (3xx)
if {[HTTP::is_redirect]}{
if {$debug}{log local0. "Original Location: [HTTP::header value Location], Updated Location: [string map {http: https:} [HTTP::header value Location]]"}
Use 'string map' to replace http: with https:
HTTP::header replace Location [string map {http: https:} [HTTP::header value Location]]
}
}
}
- Gerardo_Garcia_NimbostratusHere are some examples of non working things
- Gerardo_Garcia_NimbostratusOK, I think someone needs to help me here
- hooleylistCirrostratusThat's interesting... It looks like the ? in the regex might not be performing a lazy match on the string being searched.
when RULE_INIT { log local0. "[regexp -inline {test.*?example\.com} {test1.example.com text text test2.example.com}]" }
when HTTP_RESPONSE { Disable the stream filter by default STREAM::disable Check if response type is text if {[HTTP::header value Content-Type] contains "text"}{ log local0. "[IP::client_addr]:[TCP::client_port]: Setting stream expression, enabling filter" Replace any http:// instance with https:// only if the original string is http://*example.com: STREAM::expression {@http://.*?example\.com@@} Enable the stream filter for this response only STREAM::enable } } when STREAM_MATCHED { log local0. "[IP::client_addr]:[TCP::local_port]: matched: [STREAM::match], replaced with: [string map {http:// HTTPS://} [STREAM::match]]" STREAM::replace "[string map {http:// HTTPS://} [STREAM::match]]" }
- hooleylistCirrostratusThinking about this again, I'm guessing the reason you were seeing strings being matched which were much longer than a single domain was the regex you were testing with was wrong.
when RULE_INIT { List of *.example.com subdomains that should not be rewritten (in lowercase) set ::subddomains_to_preserve [ "keep1.example.com" \ "keep2.example.com" \ "keep3.example.com" \ ] } when HTTP_RESPONSE { Disable the stream filter by default STREAM::disable Check if response type is text if {[HTTP::header value Content-Type] contains "text"}{ log local0. "[IP::client_addr]:[TCP::client_port]: Setting stream expression, enabling filter" Replace any http:// instance with https:// only if the original string is http://*example.com: STREAM::expression {@http://.*?example\.com@} Enable the stream filter for this response only STREAM::enable } } when STREAM_MATCHED { Check if the current string matched by the stream filter is part of the list of subdomains to preserve. if {[matchclass [string tolower [STREAM::match]] equals $::subddomains_to_preserve]}{ log local0. "[IP::client_addr]:[TCP::local_port]: found [STREAM::match], but did not modify it." } else [ log local0. "[IP::client_addr]:[TCP::local_port]: found [STREAM::match], replaced with: [string map {http:// HTTPS://} [STREAM::match]]" STREAM::replace "[string map {http:// https://} [STREAM::match]]" } }
- Onettoster_3403Nimbostratus
Hi everybody, I been copying and pasting the last irule shown here, because I had a similar issue. First I had to modify that irule becouse gave to me some problems whit the syntax and other stuff. I'm new on f5 so I starting to google it how to fix it and finally I got this:
when RULE_INIT { Lista de los domininios que NO se reemplazaran set static::listado [ list /http://www.fapesp.br ] } when HTTP_RESPONSE { Desabilitar el filtro stream STREAM::disable Check if response type is text if {[HTTP::header value Content-Type] contains "text"}{ log local0. "[IP::client_addr]:[TCP::client_port]: Setting stream expression, enabling filter" Remplazar cualquier http:// por https:// STREAM::expression {@http://*@} Habilitar el filtro stream solo si corresponde STREAM::enable } } when STREAM_MATCHED { Revisar if el string actual obtenido por el filtro stream esta en la lista de dominios a conservar if { [lsearch -glob $static::listado [string tolower [STREAM::match]] ] } { log local0. "[IP::client_addr]:[TCP::local_port]: found [STREAM::match], but did not modify it." } else { log local0. "[IP::client_addr]:[TCP::local_port]: found [STREAM::match], replaced with: [string map {http:// HTTPS://} [STREAM::match]]" STREAM::replace "[string map {http:// https://} [STREAM::match]]" } }
This rule does not works and show this error: " Rule /Common/iRule_Scielo_EXCEPTIONS : 192.168.210.36:19119: found http://, but did not modify it"
So where is my problem, I only want excluding some urls from stream conversion. Thank
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