Forum Discussion

dwhite12_255934's avatar
dwhite12_255934
Icon for Nimbostratus rankNimbostratus
Jul 28, 2016

Need assistance creating an iRule to modify a URI

If the following path is detected the F5 should change the URI to append /EXAMPLE to the beginning:

/TestProcess.php

Corrected URI would be: /example/TestProcess.php

Thanks.

4 Replies

  • Do you need users to see the /example/ or is that just where you want it to land on the server side?

     

  • This will change the URI and send it to server:

    when HTTP_REQUEST {
    if { [HTTP::uri] eq "/TestProcess.php" } {
    HTTP::uri /example[HTTP::uri]
    }
    }
    

    This will send a redirect to the client asking them to request the resource again:

    when HTTP_REQUEST {
    if { [HTTP::uri] eq "/TestProcess.php" } {
    HTTP::respond 301 Location "http://[HTTP::host]example[HTTP::uri]"
    }
    }
    
  • This is just for a backwards compatibility issue, so I believe it's not important for the users to see the actual redirected URI, just where they land. Hope that makes sense.