Forum Discussion

automusPrime_13's avatar
automusPrime_13
Icon for Nimbostratus rankNimbostratus
Oct 22, 2013

Can I write a irule that uses a parameter in the url to specify the specific destination?

Troubleshooting an issue or when verifying a restarted server we have no way of specifying the specific destination server. This issue involves a Sharpoint 2010 farm environment

 

1 Reply

  • You could try something like this:

    when CLIENT_ACCEPTED {
        set default_pool [LB::server pool]
    }
    when HTTP_REQUEST {
        if { [HTTP::uri] contains "?nodeselect=" } {
            set nodeselect [split [URI::query [HTTP::uri] nodeselect] "-"]
            pool $default_pool member [lindex $nodeselect 0] [lindex $nodeselect 1]
        }
    }
    

    This expects the desired pool member in a query string:

    curl http://www.example.com/?nodeselect=10.70.0.1-80
    

    This is a very simple implementation that doesn't address persistence or security. You may want to consider running this iRule on a separate VIP that's only accessible to the internal network.