Forum Discussion

Tom_Lauwereins_'s avatar
Tom_Lauwereins_
Icon for Nimbostratus rankNimbostratus
Feb 16, 2012

Redirect traffic to same poolmember during 30 minutes

On of our customers want to redirect traffic to the same poolmember during some time.

 

They want that traffic with the same HTTP Header has to be redirected to the same pool member.

 

But it has to be working also if there is comming a new request/session with the same HTTP header field, and this for half an hour.

 

So the LTM has to link the value from the HTTP:header field to the poolmember for a given time value.

 

Is this possible with an IRule?

 

 

Regards

 

 

Tom

 

  • you can use universal persistence (uie) with 30 minutes timeout.

     

     

    persist wiki

     

    http://devcentral.f5.com/wiki/iRules.persist.ashx
  • Indeed that was my suggestion also to the 'app' guys

     

    But they want that a totally new requests possible coming from another server or after a 10 minutes and with the same content for a specific HTTP-header arrives on the same server.

     

    In my opinion, they have to solve this on application level.

     

     

    Whats your opinion?

     

     

    Regards

     

     

    Tom
  • But they want that a totally new requests possible coming from another server or after a 10 minutes and with the same content for a specific HTTP-header arrives on the same server. isn't it what universal persistence works? if persistence key is identical even it is a brand new connection, bigip will send to same pool member.
  • I made the IRule below, but it seems not to work.

     

    Do I have to select something as "Default or Fallback Persistence profile" into the VS?

     

    Now I have selected "None" and enabeled the iRule

     

     

    when HTTP_REQUEST {

     

    if {[HTTP::header exists "ul3-user"]} {

     

    persist uie [HTTP::header "ul3-user"]

     

    }

     

    }
  • this is mine.

    [root@ve1023:Active] config  b virtual bar list
    virtual bar {
       snat automap
       pool foo
       destination 172.28.19.79:80
       ip protocol 6
       rules myrule
       profiles {
          http {}
          tcp {}
       }
    }
    [root@ve1023:Active] config  b pool foo list
    pool foo {
       members {
          200.200.200.101:80 {}
          200.200.200.102:80 {}
       }
    }
    [root@ve1023:Active] config  b rule myrule list
    rule myrule {
       when HTTP_REQUEST {
       set header ""
       if {[HTTP::header exists "ul3-user"]} {
          set header [HTTP::header "ul3-user"]
          persist uie [HTTP::header "ul3-user"] 1800
       }
    }
    
    when HTTP_RESPONSE {
       log local0. "[IP::client_addr]:[TCP::client_port] -> [IP::local_addr clientside]:[TCP::local_port clientside] -> [IP::remote_addr]:[TCP::remote_port] | $header"
    }
    }
    
    on client
    
    [root@centos251 ~] curl -I http://172.28.19.79 -H "ul3-user: test1234"
    HTTP/1.1 200 OK
    Date: Fri, 17 Feb 2012 13:42:47 GMT
    Server: Apache/2.2.3 (CentOS)
    Last-Modified: Fri, 11 Nov 2011 14:48:14 GMT
    ETag: "4183e4-3e-9c564780"
    Accept-Ranges: bytes
    Content-Length: 62
    Content-Type: text/html; charset=UTF-8
    
    [root@centos251 ~] curl -I http://172.28.19.79 -H "ul3-user: test1234"
    
    
    [root@centos251 ~] curl -I http://172.28.19.79 -H "ul3-user: test1234"
    
    
    [root@centos251 ~] curl -I http://172.28.19.79 -H "ul3-user: xyz5678"
    HTTP/1.1 200 OK
    Date: Fri, 17 Feb 2012 13:38:43 GMT
    Server: Apache/2.2.3 (CentOS)
    Last-Modified: Tue, 08 Nov 2011 12:26:29 GMT
    ETag: "4183f1-30-47e02740"
    Accept-Ranges: bytes
    Content-Length: 48
    Content-Type: text/html; charset=UTF-8
    
    [root@centos251 ~] curl -I http://172.28.19.79 -H "ul3-user: xyz5678"
    
    
    on bigip
    
    [root@ve1023:Active] config  b persist show all
    PERSISTENT CONNECTIONS
    |     Mode universal   Value test1234
    |        virtual 172.28.19.79:80   node 200.200.200.101:80   age 81sec
    |     Mode universal   Value xyz5678
    |        virtual 172.28.19.79:80   node 200.200.200.102:80   age 57sec
    
    [root@ve1023:Active] config  cat /var/log/ltm
    Feb 17 05:36:06 local/tmm info tmm[4822]: Rule myrule : 172.28.19.251:45485 -> 172.28.19.79:80 -> 200.200.200.101:80 | test1234
    Feb 17 05:36:34 local/tmm info tmm[4822]: Rule myrule : 172.28.19.251:45486 -> 172.28.19.79:80 -> 200.200.200.101:80 | test1234
    Feb 17 05:36:37 local/tmm info tmm[4822]: Rule myrule : 172.28.19.251:45487 -> 172.28.19.79:80 -> 200.200.200.101:80 | test1234
    Feb 17 05:36:55 local/tmm info tmm[4822]: Rule myrule : 172.28.19.251:45488 -> 172.28.19.79:80 -> 200.200.200.102:80 | xyz5678
    Feb 17 05:37:00 local/tmm info tmm[4822]: Rule myrule : 172.28.19.251:45489 -> 172.28.19.79:80 -> 200.200.200.102:80 | xyz5678