Forum Discussion

Beinwin_264402's avatar
Beinwin_264402
Icon for Nimbostratus rankNimbostratus
Jun 21, 2016

Multiple service on same FQDN

Hi,

 

I have a doubt. We need to do something like this: We have an domain: we need that if a user put this direcction in his/her browser, the F5 send it to a server x.x.x.x, but if the user put www.example.com/something the F5 should sent it to a y.y.y.y server.

 

Is this possible?

 

Thanks in advance.

 

4 Replies

  • Perhaps make two pools, and apply an iRule like this:

     

    when HTTP_REQUEST { set uri [string tolower [HTTP::uri]]

     

    if { $uri equals "/" } {

     

    pool NOTHING_BUT_Xs

     

    }

     

    else {

     

    pool NOTHING_BUT_Ys

     

    }

     

    }

     

  • Arie's avatar
    Arie
    Icon for Altostratus rankAltostratus

    OTS02's suggestion will work, but you have to consider other resources that are likely included. For instance, where are images, scripts, style sheets etc located?

    In general, you may want to have a default server and a server for exceptions (e.g.

    /something
    ). If possible, have the site owner use the subfolder for supporting files (images, style sheets, scripts) where that makes sense.

    It can get tricky if you're using dynamic resources that require persistence even though they are hosted in different 'folders'. For instance, some .NET applications use

    /websource.axd
    for dynamically generated resources (e.g. images). If the page under
    /something
    instructs the client to request
    /webresource.axd
    you'll have to add some intelligence to the iRule to ensure that the request isn't routed to the other pool.

    Also, consider that pages (especially the home page) can be called in a variety of ways. For instance, the home page could be

    /
    ,
    /index.html
    ,
    /default.aspx
    ,
    /index.php
    , etc.

    Lastly, you'll probably want to use

    HTTP::path
    instead of
    HTTP::uri
    as the latter includes the query string parameter, which would have an effect on the string comparison you'd be doing to route the request to the proper pool.

  • Arie's avatar
    Arie
    Icon for Altostratus rankAltostratus

    @Beinwin - without knowing what kind of application you're hosting and on which platform I can't determine what kind of challenges you may run into.

    However, I would start by catching all traffic to

    /something
    and routing that to the pool for it. Set the default pool for the VIP to the pool for
    /
    . That should get you mostly there. Keep in mind that by doing that the VIP will be marked down if there's a problem with the pool for
    /
    , even if the pool for
    /something
    is perfectly fine.

  • Hi,

     

    I like iRules too, but I honestly think the best approach for you is the LTM Policies... For example, define the default pool on your VS (the one where requests NOT matching the "/something" go), and define an LTM Policy searching for the matching HTTP URI, and in action send to the right pool for that URI.

     

    No line of code required :)

     

    Sincerely