Forum Discussion

NielsH_187296's avatar
Icon for Nimbostratus rankNimbostratus
Mar 30, 2015

Multiple virtual servers for multiple applications on one server

Hi all,

So we have a server here housing multiple webapplications, each with its respective sub-URI such as /capacity/, /track/, etc..

So we would like to create a virtual server for every application in order to manage ASM. I created the following iRule, and I logged to check if everything is set up correctly. As far as I can see, everything is set up correctly.. but i'm still not getting any response back. Suggestions?

Application 1: Application 2:

Desired behaviour: prod-CMS-vs --> prod-TRACK-vs -->


    set application [getfield [virtual name] "-" 2]
    set pool "live-$application-pool"

    if [ catch { pool "$pool" } ] {
        HTTP::respond 404 content "Application pool $pool does not exist." Mime-Type "text/html"
    } else {
        switch "$application" {
        "CMS" {
            set path "capacity"
        "TRACK" {
            set path "track"
        default {
            HTTP::respond 404 content "Application $application does not exist." Mime-Type "text/html"

    HTTP::uri "/$path[HTTP::uri]"
    HTTP::header replace Host ""
    log local0. "URI is: [HTTP::uri], pool is $pool, host is [HTTP::host]"
    pool "$pool"

Any suggestions or solutions are greatly appreciated. Thank you!

3 Replies

  • (As the edit button isn't working on my browser)


    A little more info, straight from the gui or log;


    Log entry: Rule /ITSS/acg-rewrite : URI is: /capacity/, pool is live-CMS-pool, host is




    • live-CMS-pool
    • live-TRACK-pool



    • live-CMS-http-vs (redirects to port 443)
    • live-CMS-vs
    • live-TRACK-http-vs (redirects to port 443)
    • live-TRACK-vs
  • giltjr's avatar
    Icon for Nimbostratus rankNimbostratus

    You really using two external host names of:

    If you are really using two different virtual servers with two different host names most, then I would suggest you use two different iRules. That way the virtual hosts can have a single pool and you don't have to worry about what pool to select.

    Are you using SNAT or do your backend servers have a default route pointing to the F5.

  • giltjr's avatar
    Icon for Nimbostratus rankNimbostratus

    I think this is causing you problems: "HTTP::uri "/$path[HTTP::uri]"


    If they enter "" what you are then doing is changing that to ""


    I also don't think you need the line "HTTP::header replace Host """ because the host header should already be that.


    I modified what I use to select which pool to go to, which I got the original code from here on Dev Central. However I don't think you need the "HTTP::uri "/$path[HTTP::uri]" code you have:


    when HTTP_REQUEST {
        switch -glob [HTTP::uri] {
            "/capacity/*" {pool Live-CMS-pool; set path "capacity"}
            "/track/*" {pool live-TRACK-poolset; path "track"}
            default {HTTP::respond 404 content "Application pool $pool does not exist." Mime-Type "text/html"}
    log local0. "URI is: [HTTP::uri], pool is $pool, host is [HTTP::host]"