Forum Discussion

Brett_10751's avatar
Icon for Nimbostratus rankNimbostratus
Sep 28, 2011

Modify URI without redirecting then send to pool

We have a single virtual server.



The idea is when users hit this single virtual server (single domain name) they will be sent to different pools based on uri



Example: to pool jobs to pool training



I have it working but only if I create two separate irules. When I try to merge them it doesn't seem to work. Not sure what I'm doing wrong.



When they go to /jobs the pool they get sent to has a virtual directory called jobs on the web server



When they go to /training the pool they get sent to does not have a training directory, the actual directory on the web server is /wfctrain



Question 1 Looking to merge these two rules. Right now both rules are applied to a single vip with rule 1 on top.



rule 1 when HTTP_REQUEST { if { [HTTP::uri] starts_with "/training" } { HTTP::uri /wfctrain log local0. "Original URI: [HTTP::uri], New URI: /wfctrain" } }



rule2 when HTTP_REQUEST { switch -glob [HTTP::path] { /training* { pool training } /jobs* { pool jobs } default { pool } } }



Question 2 With this type of setup if they type in /training and it rewrites the uri to /wfctrain , at this point the path shows up as, once the user tries to login to the web server the web path changes to from /training to /wfctrain/portal (the uri we wanted to keep hidden is exposed). Is there any way to make it so the /training uri always stays in the path?



Question 3 Also what do people do in this situation when using a single vip and single fqdn? uri sends to unique pool that has a root page / and multiple sub directories /hr, /acct uri sends to unique pool that has a root page / and multiple sub directories /web, /it



I know you can make a default pool for domainA so one of these sites can access the home page if they just type in, but I'm confused on how to make it work for multiple web sites that have a / home page.



Thanks for all the help. This forum has been very helpful in getting me this far.




1 Reply

  • Hi Brett,



    Yes you can do what you are needing to do with a combination of iRule abilities or an iRule and the built in Virtual Server configurations.



    Incoming URI Modification:


    This can be handled with a string map replace on the incoming URL. The URL will remain unchanged in the Client Browser, but the request to the server modified. This is a one way URI Masking technique. You can see a really good example here:




    URL Correction on HTTP_RESPONSE that will correct the content for the next Client Request:


    The Hyperlinks on your website probably have the URL that you want to hide from the client and this can be corrected in a Stream Profile.



    The Stream Profile is configurable through the Management GUI, or via an iRule. For the Management GUI you can find it under (in v10.x.x):


    Local Traffic -> Profiles -> Other -> Stream



    It is as simple as inputting what you want it to look for and then what you want it to replace it with.



    Stream Profile with an iRule requires the use of a the STREAM::expression command:




    A modified / custom HTTP Profile that specifically has the "Response Chunking" option set to "Rechunk" and a blank stream profile (at the location above, create a custom stream profile that has the "Source" and "Target" options blank.



    The GUI configured Stream Profile is easy to configure, but in my opinion, doing it via an iRule is much easier to manage if you are going to be doing multiple Find and Replace actions on a single Virtual Server.



    Hope this helps.