Forum Discussion

Johnde's avatar
Johnde
Icon for Cirrus rankCirrus
Mar 16, 2020
Solved

Multiple Web Applications behind single VS

I am planning to configure multiple applications/URLs behind one Virtual server for saving my public IPs. Please suggest me how can i achieve it?

  • Hello John,

     

    You can do it using iRule. Please refer below iRule.

     

    when HTTP_REQUEST 

    {

      switch [HTTP::host] {

       

    "abc.com" {pool abc-pool}

    "xyz.com" {pool xyz-pool}

                 }

              }

     

    In this way, you can add multiple application urls alongwith its associated pool. Entries here are case sensitive. Also make sure Virtual Server Configuration like SSL& http profiles, SNAT etc is proper to handle all requests.

     

    Hope this will fulfill your requirement!

     

    Mayur

7 Replies

  • As per my knowledge there is no limitation as such. I have same setup in our environment and i've taken more than 100 web application behind one VS through same irule.

     

    I hope this resolves your query, if yes, please mark this question as solved.

     

    Mayur

  • Hello John,

     

    You can do it using iRule. Please refer below iRule.

     

    when HTTP_REQUEST 

    {

      switch [HTTP::host] {

       

    "abc.com" {pool abc-pool}

    "xyz.com" {pool xyz-pool}

                 }

              }

     

    In this way, you can add multiple application urls alongwith its associated pool. Entries here are case sensitive. Also make sure Virtual Server Configuration like SSL& http profiles, SNAT etc is proper to handle all requests.

     

    Hope this will fulfill your requirement!

     

    Mayur

  • Ok, i will check above iRule and test same. Thanks for your response.

    I'll update status here.

  •  Thanks!!!! Above iRule worked for me. Just quick question, how many maximum entries can i add in one iRule? Is there any limitation?

    • Beaker's avatar
      Beaker
      Icon for Cirrus rankCirrus

      So we have this set up and there is no real limit but processing of the iRule gets slower the longer the rule is. We had a rule that was 2000+ lines that worked fine. If you have 30+ entires the processing starts to slow after each additional entry. I would suggest is using that many entries using a data group to store the entries.

       

      We use

      set pool [class match -value [HTTP::host][HTTP::uri] starts_with dg_shared-vip]

       

      Then do check of of pool like if it needs SSL to the pool

      and finish with

      pool $pool

       

      the data group is a string list with the string being the host/uri and value being the pool.

       

      Using this we have save a lot of IP space and adding entries is simple and fairly silo'd from error.

       

      • Johnde's avatar
        Johnde
        Icon for Cirrus rankCirrus

        Hello Beaker,

         

        This is also helpful. Thank you so much.

  •  ,

    Although this seems to be very old post but you can use below iRule. It will save you from adding multiple entries everytime. Just you need to take care of pool naming here so it will match the correct pool. If no specific pool is available, request wont get forwarded.

    when HTTP_REQUEST {
        pool "pool_[string tolower [HTTP::host]]"
    }