I would like to get the current configuration location of an executing script in TrafficScript. However, I can't find anything in the docs to point me in the right direction.
The backgroud to this requirement is that I would like to push incoming traffic on a particular virtual server to specific nodes within a pool, based on some characteristic of the request.
This particular virtual server and pool run across two configuration locations. The nodes in the pool are split by configuration location, e.g. Location 1 has nodes L1Web01, L1Web02 and Location 2 has nodes L2Web01, L2Web02.
I can select a specific node using pool.use(...) however my choice of node also depends on the location that the request is coming in on - if we're in L1, I want to use an L1 node, if we're in L2, I want to use an L2 node.
Ideally I would be able to get the configuration location, but I'm also open to alternative suggestions.
Thanks in advance for any help
Solved! Go to Solution.
you can use the trafficscript function geo.getLocation() to get the current location of the trafficmanager
something like this should do the job
if (geo.getLocation() == "Location1") {
# do something and choose L1-Node
} else {
# do something else and choose L2 Node
}
you can use the trafficscript function geo.getLocation() to get the current location of the trafficmanager
something like this should do the job
if (geo.getLocation() == "Location1") {
# do something and choose L1-Node
} else {
# do something else and choose L2 Node
}
I'm an idiot, sorry - not sure how I missed this!
Thanks