Forum Discussion

Jer-O's avatar
Jer-O
Icon for Cirrus rankCirrus
Aug 30, 2018

Using iRule, specify a port for a pool that accepts all ports.

For reasons I won't justify here, I have a pool that accepts traffic on all ports, a virtual server receiving traffic on 443 (SSL), and I need an iRule that sets the server port to 1000 for all requests (no if condition; just do it always). I believe port translation should be disabled on the VIP (it currently is, though I've tried it both ways). HTTP_REQUEST is as far as the traffic gets. Traffic never gets to the pool, let alone the desired port. I've tried a dozen different methods, but none of them work. Here's some examples that do not work:

when LB_SELECTED { switch [LB::server port] { 1000 } }

when LB_SELECTED { switch [TCP::server_port] { 1000 } }

I've also tried other events to no avail with variations with and without switch.

5 Replies

  • I just want to know the syntax to designate the server port from an iRule on a pool that accepts all ports. The configs aren't relevant to the question beyond what I've already described.

     

  • Your switch syntax is wrong I guess, there is no string pattern search or default.

    But we dont need switch here, your requirement would be below,

    Your requirement would be something below,

    when LB_SELECTED {
    if {[LB::server port] == 0} {
        LB::reselect
        node [LB::server addr] 1000
    }
    
  • You can also do this:

    when CLIENT_ACCEPTED {
        pool test-pool
        log local0. "TEST: [LB::select]"
        set this_service [LB::select]
        node [lindex ${this_service} 3] 1000
    }