Forum Discussion
I like the idea of a datagroup for this. Based on the returned name of the LB:server name or even addr i can use the correct value redirect. I attempted to dump out the LB::server name but continue to get null values within HTTP_REQUEST so i have nothing to compare them to in the data group.
when HTTP_REQUEST {
log local0. "LB Server name: [LB::server name]"
log local0. "LB Server addr: [LB::server addr]"
HTTP::redirect [class lookup [LB::server name] "test.data.group"]
}
I will get log entries like: Dec 8 16:03:29 devicename info tmm[11799]: Rule /Common/irule : LB Server name: /Common/poolname 0 Dec 8 16:03:29 devicename info tmm[11799]: Rule /Common/irule : LB Server addr: Dec 8 16:03:29 devicename info tmm[11799]: Rule /Common/irule : LB Server name: /Common/poolname 0 Dec 8 16:03:29 devicename info tmm[11799]: Rule /Common/irule : LB Server addr:
I think this is because the decision to use a specific pool member hasn't been made yet. I started looking at performing the same function within HTTP_REQUEST_SEND event using the client side context.
when HTTP_REQUEST_SEND {
clientside {
log local0. "LB Server name: [LB::server name]"
log local0. "LB Server addr: [LB::server addr]"
HTTP::redirect [class lookup [LB::server name] "test.data.group"]
}
}
This resulted in me being able to dump the values of LB::server name and addr, but not able to execute the redirect. Logs are:
Dec 8 16:04:42 devicename info tmm2[11799]: Rule /irule : LB Server name: /Common/poolname 1.1.1.1 80 Dec 8 16:04:42 devicename info tmm2[11799]: Rule /Common/irule : LB Server addr: 1.1.1.1 Dec 8 16:04:42 devicename err tmm2[11799]: 01220001:3: TCL error: /Common/irule - Illegal argument. Can't execute in the current context. (line 1) invoked from within "HTTP::redirect [class lookup [LB::server name] "test.data.group"]"