Forum Discussion

briancapps_1029's avatar
briancapps_1029
Icon for Nimbostratus rankNimbostratus
Sep 21, 2010

iRule redirect - change domain, path but keep unique ID

I'm having trouble getting an iRule right that redirects domain, modifies path, but maintains a trailing unique identifier. I intend to redirect:

 

 

http://documents.test.com/retrieve.asp?guid=43w232w398s-sd

 

 

to

 

 

http://platform.test.com/Servicepages/RetrieveDocument.aspx?did=43w232w398s-sd

 

 

Where the value after the = will always be variable.

 

 

Thoughts?

 

 

12 Replies

  • Posted By hoolio on 03/18/2011 12:12 PM

    Sorry, there was a missing double quote:

    when HTTP_REQUEST {
    
        Check for requests to /retrieve.asp
       if { [string tolower [HTTP::path]] eq "/retrieve.asp"}{
    
           Redirect the request to /Servicepages/RetrieveDocument.aspx 
           with the guid parameter value set as did
          HTTP::redirect "/Servicepages/RetrieveDocument.aspx?did=[URI::query "?&[HTTP::query]" &guid]"
       }
    }
    

    Michael, the ?&[HTTP::query] and &guid parts are necessary to work around a bug in the URI::query command. See the bottom of the URI::query wiki page for details:

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

    Aaron Same Issue Still

    • Ken_B_50116's avatar
      Ken_B_50116
      Icon for Cirrostratus rankCirrostratus
      I have a very similar need to this issue. I need to change the FQDN and the path, but keep the unique ID string at the end of the whole URI, and then direct the user to the address. Did you ever get this working correctly?