Forum Discussion

Kristof_Goossen's avatar
Kristof_Goossen
Icon for Nimbostratus rankNimbostratus
Jan 30, 2010

insert a heaser in the HTTP_REQUEST_SEND event

Hi All,

 

 

I'm working on an iRule that should do certificate validation before sending it on to the next network component (that will use it for authentication).

 

 

When the certificate is validated, I want to insert an HTTP header containing the certificate. I'm doing this in the HTTP_REQUEST_SEND event, but I get this error:

 

 

TCL error: certauth - Illegal argument. Can't execute in the current context. (line 3) invoked from within "HTTP::header insert X-cert $certificate"

 

 

----------------------------------------------------------------

 

when HTTP_REQUEST_SEND {

 

if {[info exists certificate] and $certificate ne ""}{

 

log local0.info "$application - got cert. Insert header!"

 

HTTP::header insert X-cert $certificate

 

}

 

log local0.info "$application - SENDING SOME DATA..."

 

}

 

----------------------------------------------------------------

 

 

According to the wiki, this should be a valid event to use the HTTP::header commands:

 

 

Valid Events:

 

CACHE_REQUEST,CACHE_RESPONSE,HTTP_REQUEST,HTTP_REQUEST_DATA,HTTP_REQUEST_SEND,HTTP_RESPONSE,HTTP_RESPONSE_DATA,SERVER_CONNECTED

 

Note: This command may not be used in the SERVER_CONNECTED event if a standard HTTP profile is used.

 

 

Any help will be much appreciated!

2 Replies

  • Hi,

     

     

    HTTP_REQUEST_SEND is a server side event. You can use the clientside command to insert the HTTP header in the clientside context:

     

     

    clientside {HTTP::header insert X-cert $certificate}

     

     

    Aaron