Bind URI with a secific virtual server

Hello Team,

Let’s say we have 2 virtual server’s configured and both of them are listening for same web server ( Same pool ) Our requirement is we should be able to restrict access on basis of URI. So if request comes for a specific URL: it should only work with virtual server a. If somebody changes the host file and add IP addreess of virtual server B for same domain name, it should not work.

Hi,

you can try somthing like that (not tested)

when RULE_INIT {
    array set static::VS_HOST {
    /Common/VS1 "app1.company.com"
    /Common/VS2 "app2.company.com"
    }
}

whrn HTTP_REQUEST {
    if {[info exists static::VS_HOST([virtual name])] && [HTTP::host] ne $static::VS_HOST([virtual name])} {
        HTTP::respond 403 -version "1.1" content "Request RejectedYou are not authorized to access this page" noserver Connection Close
    }
}