Forum Discussion

ross_02_143242's avatar
ross_02_143242
Icon for Nimbostratus rankNimbostratus
Jan 07, 2015

Best way to append a URI - Rewrite profile ?

HI All, Trying to figure out the best way to append a URI for a VIP on an Big IP LTM, I want to use a rewrite profile but I don't think it is going to let me do what I would like to,

 

Here is the scenario:

 

I have say a URI coming into the VIP lets say HTTPS://F5.co.uk now when that hits the VIP i want to add a rewrite profile to the VIP that appends the URI with lets say /login so anything going off to the server should in effect be URI HTTPS://F5.co.uk/login

 

Is it possible with the rewrite profile to just add the append value ie /login ? or do you have to add the full URI ie HTTPS://F5.co.uk/login ?

 

If it isn't that is fine just looking at the options, It appears that you can only add the full URI in URI rules in the field server URI when creating the rewrite profile,

 

Alternatively is there a way to do this with an Irule ?

 

Thanks Ross

 

5 Replies

  • Hi Cdougal, Thanks for your response, Can this be used for HTTPS also by simply amending the HTTP values to HTTPS ? I am new to Irules so this is all unfamiliar territory ! Also the value [HTTP::host] I take it this is a naming convention for a variable ? I could use any value ?

     

    Thanks

     

    Ross

     

  • Yes, it will work with HTTP and HTTPS vips both.

    With the HTTPS vip, once the Client Side SSL profile has processed (decrypted) the traffic, the HTTP profile will allow the traffic to be processed by this kind of iRule.

    Note, for the HTTP or HTTPS VIP to be able to use this iRule, it will have to have an HTTP profile applied.

    In this case, since you want to apend the "/login" to the begining of every request, you could simplify the iRule quite a bit...

    when HTTP_REQUEST {
        HTTP::uri "/login[HTTP::uri]"
    }
    

    After it finishes with the "HTTP_REQUEST" event, the value of [HTTP::uri] will then be "/login/"

    As the difference between HTTP::uri and [HTTP::uri], it can be kind of a little complicated, but the for simplicity, when it is inside of "[]", to are pulling the value for analysis from the HTTP headers of the client request. When it's not, you are manipulating the HTTP headers.

  • Sorry, intended to include this in the last responce.

     

    One thing that can really help with iRules is the F5 iRule Editor. The really nice part about this tool is that it give you an interface directly to the TCL documentation through hyperlinks.

     

    For instance, in the iRule editor, it highlights "HTTP::uri" as a hyper link to: https://devcentral.f5.com/wiki/iRules.HTTP__uri.ashx

     

    You can get the iRule editor at: https://devcentral.f5.com/d/tag/irules%20editor

     

  • Many thanks again, Time to learn TCL ! Hopefully the editor will help ...

     

    Ross