Forum Discussion

Kate_Kattar_107's avatar
Kate_Kattar_107
Icon for Nimbostratus rankNimbostratus
Jul 14, 2008

Cloaking part of a URI

Hello,

 

 

We would like to cloak part of the uri using an irule. We want users to go to http://website.ghg.co.uk - the irule should take them to http://website.ghg.co.uk/bmi although we don't the /bmi to show in the address bar.

 

 

Is this possible? How can I do this using BigIP?

 

 

Kind Regards

 

Kate

7 Replies

  • Hi,

    You can rewrite the URI before the request is sent to the pool of web servers:

       
       when HTTP_REQUEST {   
          
           Check if the URI doesn't start with /bmi   
          if {not ([HTTP::uri] starts_with "/bmi")}{   
          
              Prepend /bmi    
             HTTP::uri "/bmi[HTTP::uri]"   
          }   
       }   
       

    This won't affect any redirects or absolute references in the page content. If you need to modify the response headers you can use HTTP::header in the HTTP_RESPONSE event or for the response body, you can use a stream profile. I'd try using the above example first and see if it works though.

    Aaron
  • Thanks Aaron. I have attempted to paste the code below into a new irule. I get the msg:

     

    01070151:3: Rule [Website_URI_cloak] error:

     

    line 4: [wrong args] [HTTP::uri starts_with "/bmi"]

     

     

    Any idea?

     

     

    Kate
  • Just a typo, that line should look like this

     
     if {not ([HTTP::uri] starts_with "/bmi")}{   
     
  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    That will, of course, come back with the Location header including the /bmi in the URL. If you're okay with that, then this will work as-is. If not, you'll need to add some Response logic to re-write the Location header on egress and make this a two-way re-write.

     

     

    Colin
  • I have this working on two VIPs, but have moved it to a third VIP that has SNAT turned on. It doesn't work. The SNAT is the only thing about the VIP setup that is different. Any ideas?
  • Source address translation shouldn't affect the HTTP headers or content. I'm guessing the other difference is the application.

     

     

    If you use LiveHttpHeaders for Firefox or Fiddler for IE, what requests do you see the client make? What responses do you see coming back from the application. You should be able to work your way back from the last request which fails to the app's previous response. I'm guessing as Colin suggested that the app might be referencing the modified URI so it's being rewritten twice in effect.

     

     

    Aaron