Forum Discussion

HarpinderVirdee's avatar
HarpinderVirdee
Icon for Nimbostratus rankNimbostratus
Jul 02, 2018

uri redirect

Hi All,

 

We are migrating Windows NLB Virtual Servers to the F5. We've noticed that the servers in the pool have a pointer to an SQL server for one of it's applications.

 

For example:

 

on the F5 we have a https VS with a pool of 3 listening on :443 - When users browse https://abc.com, it works fine.. when users browse https://abc.com/def the page breaks... now /def is hosted on the SQL server and not the server within the pool. The server in the pool has a pointer to /def.

 

Any ideas how to get around this? new to iRules but could we set a rule to redirect anything with /def to the SQL server (it sits on the same VLAN as the VS so no routing required)

 

Thanks

 

  • Snl's avatar
    Snl
    Icon for Cirrostratus rankCirrostratus

    Try below irule , HTH

    when HTTP_REQUEST {
    if { [string tolower [HTTP::uri]] equals "/" } {
    HTTP::redirect "https://[HTTP::host]"
    log local0. "redirect matched [HTTP::uri]"
    }
    }
    
  • If I understand your question you have webservers that hosts https://abc.com, but one of the subfolders (https://abc.com/def) is located on another server and all those requests should be sent to that one instead?

     

    Easiest way would be to implement a ltm-policy. First create another pool which contains the sql-server. You then create a policy and add rules and actions to it. Your rules should be something like this:

     

    1. If uri path starts with /def --> forward traffic to sql-server pool.
    2. For all traffic --> forward traffic to webserver pool.

    Then assign the policy to your virtual server (and remove the default pool which you probably have set up).

     

    The iRule you got in the other answer has nothing to do with your question. It redirect users from http to https.