Forum Discussion

vjori_231074's avatar
Icon for Nimbostratus rankNimbostratus
Feb 02, 2018

How to LoadBalance HTTP 1.1 request

Hi all,


Just to set the enviroment first 🙂


We had a customer that wanted to switch from source_addr persistence profile to a persistence based on a specific identifier that cames into http request on a XML field.


How customer works its that sends a first http request with a login and the server side answers with a login response with an specific id, an after that sends different operations using that id.


Based on that we defined an universal profile that using an irule extracts that information, analyzes the response that comes from login response. (called SessionIdLogin) and also it was needed to define an XML_profile, in order to analyze the following http request in order to obtain the id. (called xml_info)


We configured the Virtual Server with * an http profile http * XML profile * Oneconnection Profile --> Oneconnect


On the pool configuration we added the xml_info default profile and added the irule SessionIdLogin.


Inside this irule, we downgrade the HTTP in order to loadbalance all the request between the nodes.


ltm rule /Common/SessionIdLogin {
    when HTTP_REQUEST {
   HTTP::header remove "Accept-Encoding"

   if { [HTTP::version] eq "1.1" } {

      if { [HTTP::header is_keepalive] } {

         HTTP::header replace "Connection" "Keep-Alive"

      HTTP::version "1.0"

  if {[HTTP::header exists "Content-Length"] && [HTTP::header "Content-Length"] <= 1048576}{
    set content_length [HTTP::header "Content-Length"]
  } else {
      set content_length 1048576
  if { $content_length > 0} {
    HTTP::collect $content_length
    log local0. "Persist in HTTP_RESPONSE_DATA"
    set SessionId [findstr [HTTP::payload] "sessionId>" 10 "<"]
    log local0. "$SessionId"
    if {[HTTP::payload] contains "Login"} {
       persist add uie $SessionId 160


Till here it was all working fine no problems at all, but the customer noticed that sometimes the http post with login was not working, and we discovered that it was caused because they were sending and specific field from HTTP 1.1, transfer-coding: chunked. As we downgrade to 1.0 the Server didn't understand the petition and provides an error.


after all the story, Now the question. 🙂


How could we without downgrade the HTTP version load balance all the requests? Customer is not going to change their code and they still want to do the persistence based on sessionId. One think i though its to add a header inside HTTP_RESPONSE with the connection: close, but i dont know if that its going to work.


Thanks in advance people.


Victor Jori


1 Reply

  • Hi, What information do you use to persist on the request event? I see you use the persist add uie command on HTTP_RESPONDE_SEND but you still need to persist in the HTTP_REQUEST by using persist uie . I don't know if that's coming in a HTTP header o cookie. You need that to persist.



    Regarding chunking, instead of doing the transformations on the HTTP protocol, maybe is worth for you to try to configure an specific HTTP profile with option chuncked content to rechunk. This way you will have the whole response ready to inspect automatically: