Forum Discussion

nik_65678's avatar
nik_65678
Icon for Nimbostratus rankNimbostratus
Aug 19, 2009

[http::uri] in http_response

i'm wondering if there's any way to get the value of [http::uri] in the http_response event without setting a variable? here's what i have now:

when http_request { 
   set uri [http::uri] 
    
 } 
 when http_response { 
   switch -glob [string tolower $uri] { 
      
   } 
 }

this works fine but i'd like to get rid of the variable if bigip has that same information cached someplace already. [http::uri] does not work in http_response, so is there any other way?

3 Replies

  • Hi,

     

     

    A typical HTTP response doesn't include URI information (except in Location header as part of a 301/302 redirect), so no I don't believe there's any other way besides "saving" it from the request as you are already doing.

     

     

    Denny
  • As far as I'm aware, LTM doesn't save the HTTP::uri past the HTTP request events in the clientside context. The URI listed in the Location response header is completely independent of the requested URI. So I think you'll need to save the URI in HTTP_REQUEST in order to have it available in HTTP_RESPONSE. So as Denny said, this is necessary if LTM doesn't cache the value itself and you want to reference it in a server side event.

     

     

    Aaron
  • yeah, ltm doesn't keep track of either between events (request/response). i'm going to continue to set the uri/host in the request so the response knows how to manage the data going out (lots of header rewrites etc).

     

     

    i've been sanitizing our websites to work properly with limelight (cdn) via the load balancer as opposed to wrestling with a few dozen apps using different platforms. a big part of that is knowing the host and uri for the response so i can edit headers accordingly. good stuff!