Forum Discussion

Robert_47833's avatar
Robert_47833
Icon for Altostratus rankAltostratus
Mar 21, 2015
Solved

irule VS http profille

I have one interesting question which confuse me a lot today since I learn something new in BIGIP.

My questions are:

 1:If I removed one header in HTTP profile,but add same header back in irule,what is the outcome?

  2:This question makes me think the priority of profile and irule ,which is evaluated firstly and the relationship between them if they manipulate the same data?For example ,I exclude .htm from compression in profile,but enable compression of it in irule.................
  • I give it a test:

    root@(bigip1)(cfg-sync Standalone)(Active)(/Common)(tmos) list ltm profile http customer_http 
    ltm profile http customer_http {
        app-service none
        defaults-from http
        header-erase Headertest
        proxy-type reverse
    }
    
    root@(bigip1)(cfg-sync Standalone)(Active)(/Common)(tmos) list ltm rule http_header_test 
    ltm rule http_header_test {
        when HTTP_REQUEST {
            HTTP::header insert "Headertest" "123"
    }
    

    }

    Then test with curl 10.1.1.73 -H "Headertest: 123", from the capture it shows http header Headertest still in the request.

8 Replies

  • he_qiang_137361's avatar
    he_qiang_137361
    Historic F5 Account

    I give it a test:

    root@(bigip1)(cfg-sync Standalone)(Active)(/Common)(tmos) list ltm profile http customer_http 
    ltm profile http customer_http {
        app-service none
        defaults-from http
        header-erase Headertest
        proxy-type reverse
    }
    
    root@(bigip1)(cfg-sync Standalone)(Active)(/Common)(tmos) list ltm rule http_header_test 
    ltm rule http_header_test {
        when HTTP_REQUEST {
            HTTP::header insert "Headertest" "123"
    }
    

    }

    Then test with curl 10.1.1.73 -H "Headertest: 123", from the capture it shows http header Headertest still in the request.

  • Hi Robbie,

     

    I generally try to avoid conflicting configuration. Finally it´s a matter of precedence (as you already figured out) and may change with TMOS versions.

     

    Please try to stick to iRules, http-class (or policy rules if you are on TMOS v11.4+) or modifications by profile.

     

    Using iRules allow a very granular control, work conditionally and you can easily specify the context i.e. to erase a header for incoming requests (when HTTP_REQUEST) or server responses (when HTTP_RESPONSE).

     

    Please try to avoid modifications to the default http-profile (may not be synced, may prevent sync, difficult to track).

     

    Thanks, Stephan

     

  • thanks team it seems irule always win. the exact case which indicate me to ask this is : web server in my company doesn't follow HTTP protocol,if it see no accept-coding in request,it will compress response as gzip ,then send back.but if the accept-coding is shdc,web server will not compress. all I want to do is teach web server not to compress ....

     

    so : if I disable accepr-codeing in http compression profile,then insert accept-coding:shdc in request when send to server for specific uri list or content list.

     

    Does it work?

     

    Besides this:I found uri list /content list is not as I expect.

     

    in order to make /xyz* work ,it seems I need to add /xyz.* in uri list ,and add content type in content list,so confuing

     

    Correct me if I am wrong

     

  • Hi Robbie,

    the iRule would look as follows:
    when HTTP_REQUEST {
       if {[HTTP::header exists Accept-Encoding]} {
          HTTP::header replace Accept-Encoding shdc
       }
    }
    

    Regarding the syntax of path specification: your sample shows a regular expression ".*" which matches any number of any characters.

    Thanks, Stephan
  • Hi,Stephan suppose I want to compress uri starts with /xyz[any-thing-behind] ,what is the right uri list and content list to achieve this? From my test,uri list and content list compose the exact object F5 will compress.

     

    For example,if I only add /xyz.* in uri list while leave content list unconfigured,F5 doesn't compress .... I am confused by this....

     

    • StephanManthey's avatar
      StephanManthey
      Icon for MVP rankMVP
      Hi Robbie, what TMOS version are you using and do you want to split control on compression between http/acceleration profile and iRule? Thanks, Stephan
    • Robert_47833's avatar
      Robert_47833
      Icon for Altostratus rankAltostratus
      11.4 I want to use compression profile to achieve compression,instead of irule. hope u can give me advce, I am not sure how much performance it can imporve if compression is done in F5
  • he_qiang_137361's avatar
    he_qiang_137361
    Historic F5 Account

    Hi Robbie,

    You can modify the iRule as below:

    when HTTP_REQUEST {
       if {[HTTP::header exists Accept-Encoding] and [string tolower [HTTP::uri]] contains "/xyz" } {
          HTTP::header replace Accept-Encoding shdc
       }
    }
    

    It'll replace the header if the URI contains /xyz.