Forum Discussion

James_Yang_9981's avatar
James_Yang_9981
Icon for Altostratus rankAltostratus
Nov 20, 2007

remove accept-encoding header on WAM 4500

I'm currently implement WA 4500 in customer's envionment, their server has enabled compress. after WA online, I think it's better to disable server compress that will cause WA use more CPU power to decompress the content and compress it again. for failover issue, customer doesn't want to disable compress on OWS. So, the best way to do it is remove the accept-encoding header when WA send request to OWS.

 

 

the problem I meet is when I using the following rules:

 

 

when HTTP_REQUEST_SEND {

 

 

if {[HTTP::header exists "Accept-Encoding"]}{

 

HTTP::header remove "Accept-Encoding"

 

}

 

 

}

 

 

it will not work at all, error message is:

 

 

Nov 20 18:34:25 tmm tmm[7847]: 01220001:3: TCL error: removeencoding - Illegal argument. Can't execute in the current context. (line 1) invoked from within "HTTP::header exists "Accept-Encoding""

 

 

if I change the event to HTTP_REQUEST, it will work but client received the uncompressed response data.

 

 

from the wiki document, HTTP::header is supported in HTTP_REQUEST_SEND event.

 

 

any idea?

 

 

Thanks

 

4 Replies

  • Hi,

    You can use the HTTP::header commands in the HTTP_REQUEST_SEND event if you force their evaluation in the clientside context (Click here).

    
    when HTTP_REQUEST_SEND {
    clientside {
       if {[HTTP::header exists "Accept-Encoding"]}{
             HTTP::header remove "Accept-Encoding"
          }
       }
    }

    or:

    
    when HTTP_REQUEST_SEND {
       if {clientside {HTTP::header exists "Accept-Encoding"}}{
          clientside {HTTP::header remove "Accept-Encoding"}
       }
    }

    Aaron
  • Thanks response, but it doesn't work and just like remove the header in HTTP_REQUEST event.

    At last, under ENE support. I got the function working by following rules:

    
    when HTTP_REQUEST {
       if {[HTTP::header exists "X-PvMAC"]} {
          if {[HTTP::header exists "Accept-Encoding"]}{
            HTTP::header remove "Accept-Encoding"
          }
       }
    }
  • If you don't need to use the HTTP_REQUEST_DATA event, that method is cleaner. I have successfully tested using the clientside command with HTTP::header commands in the HTTP_REQUEST_DATA event though. Maybe the issue is something new with 9.4.2 or 9.4.3?

     

     

    Anyhow, it's good to hear you got it working.

     

     

    Aaron
  • not sure, may because of the internal VS of WA.

     

    the request in an 9.x WA will be like this:

     

     

    request->vs->tmm->pvac->internal vs->tmm->server

     

     

    so the event will be hit twice. even serverside event was executed when tmm send traffic to pvac. that may cause the client header accept-encoding was removed. so when pvac accept the request, it has no accept-encoding header in the request, that pvac will not compress the content when it receive the server response.