Forum Discussion

rahulc_290651's avatar
rahulc_290651
Icon for Nimbostratus rankNimbostratus
Dec 29, 2016

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.

 

1 Reply

  • 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
        }
    }