Rewriting the URL for specific pool members

How to use this snippet:

when RULE_INIT {

set static::new_app_nodes "1.1.1.1 443 2.2.2.2 443 3.3.3.3 443" 

}

when HTTP_REQUEST_SEND {

if { $static::new_app_nodes contains "[LB::server addr] [LB::server port]" } then {

    log -noname local0.debug "Match! [members -list $static::new_app_nodes] contains [LB::server addr] [LB::server port]"

    clientside {

        HTTP::uri "/uri"

    }

} else {

    log -noname local0.debug "Don't match! [members -list $static::new_app_nodes] contains [LB::server addr] [LB::server port]"

}

}

Code :

when RULE_INIT {

    set static::new_app_nodes "1.1.1.1 443 2.2.2.2 443 3.3.3.3 443" 

}

when HTTP_REQUEST_SEND {

    if { $static::new_app_nodes contains "[LB::server addr] [LB::server port]" } then {

        log -noname local0.debug "Match! [members -list $static::new_app_nodes] contains [LB::server addr] [LB::server port]"

        clientside {

            HTTP::uri "/uri"

        }

    } else {

        log -noname local0.debug "Don't match! [members -list $static::new_app_nodes] contains [LB::server addr] [LB::server port]"

    }

}

Tested this on version:

11.4
Updated Jun 06, 2023
Version 2.0
No CommentsBe the first to comment