Forum Discussion

Bill_8097's avatar
Bill_8097
Icon for Nimbostratus rankNimbostratus
Mar 07, 2013

IRule to remove all headers with the same base name

Due to header length limitations of my backend application I need to remove un-used headers that are being sent from my WebSeal to the backend.

 

I have the following IRule in place now:

 

when HTTP_REQUEST {

 

log local0.info "[HTTP::header iv-creds]"

 

HTTP::header remove iv-creds

 

HTTP::header remove iv-creds-1

 

HTTP::header remove iv-creds-2

 

HTTP::header remove iv-creds-3

 

HTTP::header remove iv-creds-4

 

HTTP::header remove iv-creds-5

 

HTTP::header remove iv-creds-6

 

}

 

Is it possible to wildcard the header iv-creds? That header is split and can grow to additional headers. For example sometimes I have iv-creds plus iv-creds 1-9.

 

I'm trying to make this as efficient as possible. Thank you for your help!

 

2 Replies

  • may we loop HTTP::header names?

    e.g.

    [root@ve10:Active] config  b virtual bar list
    virtual bar {
       snat automap
       pool foo
       destination 172.28.19.252:80
       ip protocol 6
       rules myrule
       profiles {
          http {}
          tcp {}
       }
    }
    [root@ve10:Active] config  b pool foo list
    pool foo {
       members 200.200.200.101:80 {}
    }
    [root@ve10:Active] config  b rule myrule list
    rule myrule {
       when HTTP_REQUEST {
      foreach aheader [HTTP::header names] {
        if { $aheader starts_with "iv-creds" } {
          HTTP::header remove $aheader
        }
      }
    }
    }
    
    [root@ve10:Active] config  ssldump -Aed -nni 0.0 port 80
    New TCP connection 1: 172.28.19.251(42603) <-> 172.28.19.252(80)
    1362699807.7819 (0.0007)  C>S
    ---------------------------------------------------------------
    HEAD / HTTP/1.1
    User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
    Host: 172.28.19.252
    Accept: */*
    something: aaa
    iv-creds: 111
    iv-creds-1: 222
    somethingelse: 333
    
    ---------------------------------------------------------------
    
    New TCP connection 2: 200.200.200.10(42603) <-> 200.200.200.101(80)
    1362699807.7829 (0.0006)  C>S
    ---------------------------------------------------------------
    HEAD / HTTP/1.1
    User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
    Host: 172.28.19.252
    Accept: */*
    something: aaa
    somethingelse: 333
    
    ---------------------------------------------------------------