Forum Discussion

vyrs_278584's avatar
vyrs_278584
Icon for Nimbostratus rankNimbostratus
Jul 12, 2016

Display specific headers

I'm passing PKI certificate information inside headers and have a VIP that displays a user's headers for troubleshooting access problems. I updated my iRule to insert the entire certificate into a header but I don't want this information displayed along with the headers I usually pass. How can I display all of my headers except the one titled base64?

How I insert the whole certifiate into the headers:

HTTP::header replace BASE64 [X509::whole [SSL::cert 0]]

How I normally display headers on my troubleshooting site:

foreach header [HTTP::header names] {
  set HEADER_RESPONSE "$HEADER_RESPONSE > $header = [HTTP::header $header]
"
 }

My attempt to fix exclude the whole certificate header:

  foreach header [HTTP::header names] {
            if { ! [matchclass [string tolower [HTTP::header names]] starts_with "base" ]} {
                            set HEADER_RESPONSE "$HEADER_RESPONSE > $header = [HTTP::header $header]
"}}

2 Replies

  • Hello, what are you using matchclass in you condition ? remove that and that should do the trick.

     

  • you don't need matchclass as it is for datagroup matching.

    This is a bit of a basic programming errror. All you need to do is just skip the loop iteration you don't want using continue operator:

    foreach header [HTTP::header names] {
            if {$header eq "BASE64"} {continue}
            set HEADER_RESPONSE "$HEADER_RESPONSE > $header = [HTTP::header $header]
    "
     } 
    

    Hope this helps,

    Sam