Forum Discussion

Bohun_115093's avatar
Bohun_115093
Icon for Nimbostratus rankNimbostratus
May 16, 2014

Identical websites accessed with different URL's

Hello, I am after some assistance.

 

The scenario is as follows: We have four web servers for a single application. The first two are configured with the "production' web site. Then we have a training website (identical to production) and a test website (also close to production). Our web architecture has an F5 in our outer DMZ, and an F5 in our inner DMZ.

 

All sites (Production/Test and training) all have site.com as the root site. We need to access the production pool when someone browses site.com, the traingin pool when someone browses site.com/training and the test when someon browses site.com/test.

 

I have tried uri rewrites and pool selection based on the uri. So site.com/training goes to the training pool, and rewrites as /.

 

What I am not sure about is how to identify the return traffic form the site.com.training server and have the F5 prepend the uri with /training again, so it doesnt re-direct the client to the production server.

 

Any help or thoughts would be appreciated!

 

5 Replies

  • when HTTP_REQUEST { if {[HTTP::uri] equals "training"} { pool pool_training } elseif {[HTTP::uri] equals "testing"} { pool pool_testing } elseif {[HTTP::uri] equals ""} {pool pool_prod} else {discard} }

     

    Are u saying you have something similar like above and it does not work. I may be formatting the above iRule incorrectly so please check the syntax and also if any user comes in with any other uri other that you mentioned the connection will be dropped. You can also use a switch statement to do the above.

     

    Why are you rewriting the uri...I did not understand am I missing something. Please let me know.

     

  • Hi, my current (test) irule pasted below. The uri is being re-written because the application team want a test environment which can be 'cloned' straight to prod after testing new releases etc, yet wanting the site accessible using the /test url. Does that make sense? The below would work perfectly for me if they had the test and training in /test and /training on the server (without a uri rewrtie).

     

    when HTTP_REQUEST { log local0. "irule Test_5 HIT" if {[string tolower [HTTP::uri]] starts_with "/training" } { HTTP::uri [string map -nocase {"/training" "/"} [HTTP::uri]] pool Training_Pool log local0. "Training Pool selected match on training" } elseif {[string tolower [HTTP::uri]] starts_with "/test" } { HTTP::uri [string map -nocase {"/test" "/"} [HTTP::uri]] pool TEST_POOL log local0. "TEST_POOL selected matched on test" } else { pool Prod_Pool log local0. "Else statement matched and sent to Prod_Pool" } }

     

  • when HTTP_REQUEST {

     

    log local0. "irule Test_5 HIT" if {[string tolower [HTTP::uri]] starts_with "/training" } {

     

    HTTP::uri [string map -nocase {"/training" "/"} [HTTP::uri]]

     

    pool Training_Pool

     

    log local0. "Training Pool selected match on training"

     

    } elseif {[string tolower [HTTP::uri]] starts_with "/test" } {

     

    HTTP::uri [string map -nocase {"/test" "/"} [HTTP::uri]]

     

    pool TEST_POOL

     

    log local0. "TEST_POOL selected matched on test"

     

    } else {

     

    pool Prod_Pool

     

    log local0. "Else statement matched and sent to Prod_Pool"

     

    }

     

    }

     

  • If I may add, what you're attempting to do is not easy. It's straight forward enough to replace headers and URIs on the way in, but another thing entirely to replace the headers and URIs in the payload on the way out. There are some tools like the ProxyPass iRule and the rewrite profile in 11.4 and above that will do this mapping for you, and it may even be worth your while to create the 4 applications on four internal VIPs with separate ProxyPass or rewrite configs, and then use an external layered VIP to pass traffic to the internal VIPs according to URI pattern. You may also want to consider just putting the 4 applications on separate VIPs with separate IPs and use Hosts entries or DNS to move between them.

     

  • just thinking if all references in response page are using relative path (i.e. not absolute path), maybe we do not need to rewrite uri in the response. only remove /training/ or /test/ in the request.