Forum Discussion

Clint_Denham_16's avatar
Clint_Denham_16
Icon for Nimbostratus rankNimbostratus
Aug 07, 2009

How to log when invalid response received

Hiyo - long time lurker who needs some basic help.

 

 

Not trying to get free support - just need an iRule example.

 

 

We are encountering a problem with a new SAP application that runs through our 6400Es. If we bypass the LB virtual server, and go direct to the pool member, we don't encounter this problem.

 

 

When the application performs a redirect to the client, the browser session hangs and a white screen appears and the page is never rendered. The redirect contains a Location header that looks like this...

 

 

(Status-Line)HTTP/1.1 302 Moved temporarily

 

Cache-Controlprivate

 

Cache-Controlmax-age=0

 

content-length10113

 

content-typetext/html; charset=utf-8

 

DateFri, 07 Aug 2009 15:09:22 GMT

 

expires0

 

locationmain.htm

 

ServerSAP Web Application Server (1.0;700)

 

 

I'm thinking that the Location header is not correctly formatted (no leading forward slash). We disabled the HTTP profile that is associated with the virtual server, and now the client receives the page as expected. The HTTP profile is the default profile that comes with the product. We're wondering if the HTTP profile has some HTTP request/response checking that is balking at this seemingly incorrect response.

 

 

Without opening up a case with F5, we'd like to see if there is a way to log what the F5 is doing when it receives this response.

 

 

Can anyone provide an iRule sample to log all HTTP request/response, and the F5's handling of those requests/responses? Admittedly, the leading forward slash might be a red herring, but I'd still like to see how the F5 is handling this traffic and why the traffic is failing.

 

 

Thanks in advance...

 

c

1 Reply

  • You can log when LTM parses the response headers from the server in the HTTP_RESPONSE event. But I'm not sure that's going to help here as there isn't a way to log the response headers sent to the client to compare the two. To be honest though, I wouldn't expect this response to break the response sending. Maybe it's an issue with response redirect rewriting on the HTTP profile? I'd think a tcpdump on the two VLANs would be your best bet to see what's happening. You could also check the /var/log/ltm log file for any related errors.

    There are a few logging iRules in the Codeshare:

    http://devcentral.f5.com/Wiki/default.aspx/iRules.CodeShare

    Here's one which specifically logs the clientside request and serverside response headers.

    http://devcentral.f5.com/wiki/default.aspx/iRules/LogHttpHeaders.html

    To run a tcpdump on both VLANs you can use:

    tcpdump -i 0.0 -s 0 -w /var/tmp/sap.dmp host CLIENT_IP or host NODE_IP

    Is the reference to main.htm in the root or in the same path as the request was made to (/whatever/main.htm)? You could rewrite the redirect Location header value using an iRule:

     
      when HTTP_REQUEST {  
      
          This event is only necessary if you need to log the requested path  
         set path [HTTP::path]  
      }  
      when HTTP_RESPONSE {  
      
          Check if response is a redirect  
         if {[HTTP::is_redirect]}{  
      
             Check if Location header value doesn't start with http  
            if {not ([string match -nocase "http*" [HTTP::header Location]])}{  
      
                Check if Location header value doesn't start with /  
               if {not ([string match -nocase "/*" [HTTP::header Location]])}{  
      
                   Rewrite Location header value by prepending a forward slash  
                  HTTP::header replace Location "/[HTTP::header Location]"  
      
                   Or you could save the HTTP::path value to $path in HTTP_REQUEST and then use this  
                     to prepend the requested path to the redirect Location  
                  HTTP::header replace Location [string range $path 0 [string last "/" $path]]  
               }  
            }  
         }  
      }  
       

    Aaron