Forum Discussion

Steve_W_85246's avatar
Steve_W_85246
Icon for Nimbostratus rankNimbostratus
Mar 21, 2014

Accessing Custom Request Header fields inserted from Back end Application

Is there a way to access Custom HTTP Request Header fields that are inserted from a backend application using iRules? I am accessing a web page from the webserver that is displaying all the Request Header fields - including some custom header fields created by this application. So the header fields are present at the time this page renders.

 

I have been trying to use iRules to access these custom header fields, but when I dump the header, I only see the basic request header fields, none of the custom fields. I am assuming this is the case because I am querying the header from the HTTP_REQUEST event, and that this event is firing before that backend application page has inserted the custom fields into the header.

 

So, my question is, is there an event where I can query the header and pull these fields that the application inserted?

 

4 Replies

  • if the backend application is responding back through the BIG-IP, then you should be able to access these headers in the HTTP_RESPONSE event.

     

  • Thanks for responding. Yes, the backend application is responding back through BIG-IP, but when querying the header in the HTTP_RESPONSE event, I only the see typical header fields:

     

    HTTP/1.1 200 OK Date: Fri, 21 Mar 2014 16:51:30 GMT Cache-Control: no-cache Content-Type: text/html; charset=UTF-8 X-Powered-By: Servlet/3.0 JSP/2.2 Connection: close Transfer-Encoding: chunked

     

    But none of the custom fields.

     

  • if you take a packet capture on the server side vlan, do you see the headers on the wire?

     

  • Try this:

    when HTTP_REQUEST {
        log local0. "Request URI = [HTTP::uri]"
        foreach x [HTTP::header names] {
            log local0. "Request header($x) = [HTTP::header $x]"
        }
    }
    when HTTP_RESPONSE {
        log local0. "Response status = [HTTP::status]"
        foreach x [HTTP::header names] {
            log local0. "Response header($x) = [HTTP::header $x]"
        }
    }