Forum Discussion

Moe_Jartin's avatar
Aug 03, 2010

Remove Multiple Headers

We have an issue where a SSO application is inserting headers which back end applications use to personalize content. There is a bug in the application software that causes problems if headers are inserted with no value. I have been tasked with writing an irule to fix the issue until the bug is resolved. I have been researching the forums for how to remove all request headers that have a null value but, I still haven't even come close to a working irule.

 

 

I know I need to build an array or set a variable listing the name of each header that has no value and then use the "HTTP::header remove" command to get rid of them. I just have no idea how to get and store the null value header names. HELP???

 

1 Reply

  • Hi Joe,

    Here is an example which will remove request headers that don't have a value:

    when HTTP_REQUEST {
    
        Loop through each header by name
       foreach a_header [HTTP::header names] {
    
           Check if the header value is empty
          if {[HTTP::header $a_header] eq ""}{
    
              Remove the header
             HTTP::header remove $a_header
          }
       }
    }
    

    Aaron