Forum Discussion

dennypayne's avatar
dennypayne
Icon for Employee rankEmployee
May 20, 2009

Command ordering with stream profile

Hi all,

Does anyone have any explanations as to why the order of commands matters here?

Using the HTTP_RESPONSE event below:

  
 when HTTP_REQUEST {  
  
      save original hostname and place it in xHost header  
      set orighost [HTTP::host]  
      HTTP::header insert "xHost" $orighost  
  
       see if vchannel was requested (ie, last char of hostname is v, ignoring the .example.com)   
       set boxname [string tolower [getfield [HTTP::host] "." 1]]  
         if { $boxname ends_with "v" } {  
               set channel "v" 
            } else {  
               set channel ""  
            }  
  
        build the new Host header and $WSSN header  
        HTTP::header replace "Host" rwa$channel.example.com  
        HTTP::header replace "\$WSSN" rwa$channel.example.com  
  
    make sure all cookies use wildcard of .example.com as their domain  
    foreach N [HTTP::cookie names] {  
       HTTP::cookie domain $N .example.com  
    }  
  }  
  
  when HTTP_RESPONSE {  
  
      Disable the stream filter by default  
     STREAM::disable  
  
      Check if response type is text  
     if {[HTTP::header value Content-Type] contains "text"}{  
  
         Replace any instance of rw*.example.com with original Host header  
      STREAM::expression "@rw.*?.example.com@$orighost@"  
  
         Enable the stream filter for this response only  
        STREAM::enable  
     }  
  
  make sure all cookies use wildcard of .example.com as their domain 
    foreach N [HTTP::cookie names] {   
     HTTP::cookie domain $N .example.com 
    }  
  }  
 

The page stalls and never loads. No errors are thrown in /var/log/ltm either.

But if the order is changed to:

  
 when HTTP_RESPONSE { 
  
  make sure all cookies use wildcard of .example.com as their domain    
   foreach N [HTTP::cookie names] {   
    HTTP::cookie domain $N .example.com    
   }  
  
   Disable the stream filter by default  
     STREAM::disable  
  
      Check if response type is text  
     if {[HTTP::header value Content-Type] contains "text"}{  
  
         Replace any instance of rw*.example.com with original Host header  
      STREAM::expression "@rw.*?.example.com@$orighost@"  
  
         Enable the stream filter for this response only  
        STREAM::enable  
     }  
 }  
 

Then the page loads normally. Should stream operations always come last in an event? Thoughts?

Denny

1 Reply

  • Hey Denny,

     

     

    I've never run into that and I'm pretty sure I've used commands after the stream related commands in HTTP_RESPONSE (in 9.3 and probably 9.4 as well). Which version are you running? If you add logging do you see the cookie domain update and stream command being run? Can you reproduce the issue with any other commands besides HTTP::cookie domain?

     

     

    Aaron