Forum Discussion

elvisc_26948's avatar
elvisc_26948
Icon for Nimbostratus rankNimbostratus
Feb 04, 2010

Extract URI from http_response

We have an application that generate unique session IDs by the server(NOT client), and Its part imbedded as part of the URI path.

 

 

My question is how do I extract that URI from the HTTP_RESPONSE so I can persist so subsequent request would stick to the same server.

 

 

thx in advance.

 

 

4 Replies

  • The URI is not available in the context of the HTTP Response event. If you need to know what it is from the original request, you need to store that in a session variable in the HTTP_REQUEST event.

    when HTTP_REQUEST { 
       set uri [HTTP::uri] 
     } 
     when HTTP_RESPONSE { 
       log local0. "Returning response for URI: $uri" 
     }

    Hope this helps...

    -Joe
  • Yes but the problem with that is the session ID has to be generated by the client...in my case its generated by the server and I have to persistent the session in the HTTP_RESPONSE_DATA.

     

  • I haven't tested it fully, but I played around with using a stream filter and iRule to search response content for a string and add a persistence record based on it:

     

     

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

     

     

    It sounds like this might work for your scenario.

     

     

    Aaron
  • I added a note to the Codeshare example which shows the need to parse the persistence token from some portion of request headers or payload. If you try this, could you let me know how it goes? I or you can then update the codeshare example if there are any issues.

     

     

    Thanks,

     

    Aaron