For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

silver's avatar
silver
Icon for Nimbostratus rankNimbostratus
Sep 26, 2012

URI Rewrite

HI All,

 

 

I have a specific requirement to rewrite the URI when the user requests the URL and the change has to be made interanlly without knowing to the external user.

 

Original URL : https://www.abc.com/customer/context/html need to be changed internally as below

 

https://abc.com/testcustomer/testcontext/html

 

Can anyone help me by providing an iRule matching the above.

 

Thanks in advance.

 

14 Replies

  • silver's avatar
    silver
    Icon for Nimbostratus rankNimbostratus
    Hi Mike,

     

     

    Basically i need a change only in the context path.

     

     

    https://abc.com/testcustomer/testcontext/html need to internally rewritten as

     

     

    https://abc.com/customer/context/html

     

     

    So the context testcustomer should be replaced by customer and testcontext to be replaced as context for all the incoming requests and the end user should not see any change in browser.

     

  • nathe's avatar
    nathe
    Icon for Cirrocumulus rankCirrocumulus
    Is this possibly the trailing slash issue?

     

    What happens if you browse to

     

    https://abc.com/testcustomer/testcontext/html/ ?

     

     

    Just a thought. You may need to slightly amend your irule logic too.

     

     

    N
  • silver's avatar
    silver
    Icon for Nimbostratus rankNimbostratus
    no difference.

     

     

    receiving the same output and not working. :-(
  • Hi Silver,

    Try this:

    
    when HTTP_REQUEST {
    if { ( [string tolower [HTTP::uri]] contains "/testcustomer" ) or ( [string tolower [HTTP::uri]] contains "/testcontext" ) } {
    HTTP::uri [string map {"/testcustomer" "/customer" "/testcontext" "/context"} [HTTP::uri]]
    }
    }