For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

Janek_42109's avatar
Janek_42109
Icon for Nimbostratus rankNimbostratus
Oct 03, 2014

Insert custom HTTP header determined by VS protocol

Dear all,

I have two VS sending the traffic to the same pool server. The idea was to be able to identify from the log server from which VS (HTTP or HTTPS) the traffic was coming from.

So I implemented this irule but it's not working.

Does anyone has an idea of what is wrong with ths irule ?

when CLIENT_ACCEPTED {
   switch [TCP::local_port] {
      "443" {
         set proto "https"
      }
      "80" {
         set proto "http"
      }
   }
}


when HTTP_REQUEST {
HTTP::header insert VS_HTTP_PROTO $PROTO
}

Thank you a lot for your help !!

2 Replies

  • There are potentially two problems:

    1. You've defined a local variable called "proto", but then accessing it as "PROTO". TCL is case sensitive.

    2. I've found that many versions of IIS don't like headers with underscores in them. It will natively replace dashes with underscores, but doesn't seem to like it when the header names arrive with underscores.

    Try this:

    when CLIENT_ACCEPTED {
        switch [TCP::local_port] {
            "443" {
                set proto "https"
            }
            "80" {
                set proto "http"
            }
        }
    }
    when HTTP_REQUEST {
        HTTP::header insert VS-HTTP-PROTO $proto
    }