Forum Discussion

Michael_Smith_6's avatar
Michael_Smith_6
Icon for Nimbostratus rankNimbostratus
Feb 25, 2009

HTTP Rewrite

All,

 

 

I apologize to be posting something that I think should be simple, but I just can't seem to figure out how to do. I've went through the forum, but I just can't find this specific example. What I have is an instance where I have a pool of web servers sitting behind a pair of LTMs. I need to rewrite the URI coming in and add a string to it on the initial HTTP request being present to the pool. As an example, a client would request http://www.abc.com/file.htm. When this request went to the pool, I would need it to be http://www.abc.com/insertedstring/file.htm. The last part of the uri (file.htm) varies and could be virtually any html file, image, etc. on the web servers serving up content. Any help that anyone can provide me would be greatly appreciated. Thanks in advance.

 

 

Mike

2 Replies

  • Hi Mike,

    To rewrite the requested path and insert a string, you can use HTTP::path. If the application includes references to the inserted string in response headers or content, you can remove them. Here is an example of the first option. Let me know if you need to rewrite the response.

     
     when HTTP_REQUEST { 
      
         Insert /string/ to beginning of path 
        HTTP::path "/string/[HTTP::path]" 
     } 
     

    Aaron
  • Aaron,

     

     

    Yep, that did exactly what I needed it to do. Figured it would be something simple. Appreciate you taking the time to respond. Thanks again.

     

     

    Mike