Forum Discussion

satish_txt_2254's avatar
Apr 30, 2017

disable http 1.1 not working with iRules

I have created following iRules to force or downgrade

1.1
to
1.0
but its not working some how

 Disable HTTP 1.1 request
when HTTP_REQUEST { 

     Don't allow response data to be chunked 
    if { [HTTP::version] eq "1.1" } { 

        Force downgrade to HTTP 1.0, but still allow keep-alive connections. 
        Since HTTP 1.1 is keep-alive by default, and 1.0 isn't, 
        we need make sure the headers reflect the keep-alive status. 

        Check if this is a keep alive connection 
       if { [HTTP::header is_keepalive] } { 

           Replace the connection header value with "Keep-Alive" 
          HTTP::header replace "Connection" "Keep-Alive" 
       } 

        Set server side request version to 1.0 
       HTTP::version "1.0" 
    } 
}

I have applied iRules to VS and for test i did following

$ curl -kI -A "Chrome" -L http://www.example.com
HTTP/1.1 403 Forbidden
Date: Sun, 30 Apr 2017 22:15:14 GMT
Server: Apache
Keep-Alive: timeout=15, max=1000
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1

What i am doing wrong? If i doing same thing in apache web server httpd.conf using

force-response-1.0
it works but i want to use iRules instead of editing 10 Web server.

  • JG's avatar
    JG
    Icon for Cumulonimbus rankCumulonimbus

    If your problem is on the client side, you are better off using the following:

    when HTTP_RESPONSE {
        HTTP::version "1.0"
        if {[HTTP::header exists "Transfer-Encoding"]} {
            HTTP::payload unchunk
            HTTP::header remove "Transfer-Encoding"
        }
    }
    

    ; if your problem is on the server side, you should not use the OneConnect profile, and you can use:

    when HTTP_REQUEST_SEND {
        HTTP::version "1.0"
    }