For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

Malcolm_Sydney1's avatar
Malcolm_Sydney1
Icon for Nimbostratus rankNimbostratus
Oct 01, 2015

Irule to laod balance based on soap session ID

Hi

 

I have a request to search a soap message for the session ID. Based on the first 2 values in the ID I will then need to send the request to a pool member. Below is an example of the message. If the starts with 01 then go to pool member 1. If the starts with 02 then go to pool member 2. if there is no 01 or 02 then load balance normally(round robin) across the 2 servers .

 

Any assistance will be helpful

 

http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">http://www.eskom.co.za/IAM_MyEskom/">MYCOMPACUST01S1441888421150m4j07NyGit506Z377zDe81FHkA0U0yO9iibnFXUN8852755my@gmail.com

 

4 Replies

  • Hi

     

    I have a request to search a soap message for the session ID. Based on the first 2 values in the ID I will then need to send the request to a pool member. Below is an example of the message. If the starts with 01 then go to pool member 1. If the starts with 02 then go to pool member 2. if there is no 01 or 02 then load balance normally(round robin) across the 2 servers .

     

    Any assistance will be helpful

     

    http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">http://www.eskom.co.za/IAM_MyEskom/">MYCOMPACUST01S1441888421150m4j07NyGit506Z377zDe81FHkA0U0yO9iibnFXUN8852755my@gmail.com

     

    • Malcolm_Sydney1's avatar
      Malcolm_Sydney1
      Icon for Nimbostratus rankNimbostratus
      MYCOMPACUST01S1441888421150m4j07NyGit506Z377zDe81FHkA0U0yO9iibnFXUN8852755my@gmail.com
  • You would probably need to do something with HTTP::collect to get the payload so you can search it and find the string.

     Collect a request payload
    when HTTP_REQUEST {
    
      if {[HTTP::method] eq "POST"}{
         Trigger collection for up to 1MB of data
        if {[HTTP::header "Content-Length"] ne "" && [HTTP::header "Content-Length"] <= 1048576}{
          set content_length [HTTP::header "Content-Length"]
        } else {
            set content_length 1048576
        }
         Check if $content_length is not set to 0
        if { $content_length > 0} {
          HTTP::collect $content_length
        }
      }
    }
    when HTTP_REQUEST_DATA {
       do stuff with the payload
      set payload [HTTP::payload]
    }
    

    From there, you would want to manually specify the pool member to route the request to (see here). Something like this in the HTTP_REQUEST_DATA event:

    if { $payload contains "01" } {
      node 10.0.0.1 80
    } else if {$payload contains "02"} {
       I forget if it's "elseif" or "else if"
      node 10.0.0.2 80
    }
    

    Then, if you don't have either, it'll load balance as normal.