Forum Discussion

W__Tout_99150's avatar
W__Tout_99150
Icon for Nimbostratus rankNimbostratus
Feb 28, 2007

Modifying response header

Hi,

 

 

I need to know if there's a way to append an extra header to the response without losing the original headers. If I use the following statement in HTTP_RESPONSE_DATA scope:

 

 

HTTP::respond 200 content [HTTP::payload] Cache-Control "no-transform"

 

 

I end up losing most of the original headers. On top of that different incoming requests would generate different responses. This means that I do not know apriori the list of the response headers. I had the idea of dynamically appending the headers to the respond statement but the iRule editor gives errors when I use something like:

 

 

when HTTP_RESPONSE {

 

foreach Rheader (@headerlist) {

 

if {[HTTP::header contains "${Rheader}"]} {

 

set Oheader "${Oheader}.${Rheader}"

 

}

 

}

 

}

 

when HTTP_RESPONSE_DATA {

 

HTTP::respond 200 content [HTTP::payload] ${Oheader}

 

}

 

 

Can anyone please suggest a way to append the extra Cache-Control header to the response header without losing the original headers or having to list them one by one?