Irules Data-Group
Hi,
Need your assistance into this topic related to Irule Based on Data-Groups:
- Currently we have total 120 Virtual-Servers( 60 HTTP profiles + 60 HTTPS Profiles) created into the Load-Balancer for single customer.
- And into every profile they specified/attached the below Irule:
Let’s say For HTTP Profile Irule:
when CLIENT_ACCEPTED { set default_pool [LB::server pool] log local0. "Default pool [LB::server pool] set" log local0. "Client IP is [IP::remote_addr]" }
when HTTP_REQUEST { set https_uri [string tolower [HTTP::uri]] log local0. "requested [HTTP::uri]" if {$https_uri equals "/" } { HTTP::redirect "https://parveez.com" pool pool_parveez.com log local0. "redirected from /"
return
} elseif { $https_uri starts_with "/iss_static" } {
log local0. "matched /iss_static"
pool pool_confarmsp.leni2.com_http
log local0. "pool_confarmsp.leni2.com_http defined, [LB::server pool] selected" return
} elseif { $https_uri starts_with "/"} { log local0. "URI starts with /"
pool pool_apuat_leni2.com_http
log local0. " pool_apuat_leni2.com_http defined, [LB::server pool] selected" return
} else {
log local0. "no match for rev. close connection"
pool pool_apuat_leni2.com_http }
}
- Just to give you a brief about the Irules, the client got two kinds of pages; One is Static content which is specified by "/iss_static" , while else option is for Dynamic content which is identified by entry /SEUILibrary/ which consists of many options inside.
Now requirement is to add/edit such an irule using Data-Groups so that when the user hits the Virtual-Server, it will automatically understand based on the "/iss_static" or else going to the pool and understands it as /SEUILibrary/ for dynamic content, into the same Data-groups it automatically should understand which pool to go BY SEEING its name.
For example:
- Lets say we have three Virtual-servers:
www.abc.com-HTTP ------ Pool named as : pool-abc.com-HTTP www.def.com-HTTPS ------ Pool named as : pool-def.com-HTTP www.ghi.com-HTTPS ------ Pool named as : pool-ghi.com-HTTP
- So, these got an Irule with "/iss_static" : for static page content and if not it will go for /SEUILibrary/ for dynamic page content.
- So, basically we are looking for an Irule using Data-Group which contains "/iss_static" and /SEUILibrary/ and also when this Irule is attached to the Virtual-server it will automatically should send which pool to Go by comparing the common parameters like abc Virtual-server which is matching with abc named pool( nomenclature is same: Virtual-server: www.abc.com-HTTP and Pool: pool-abc.com-HTTP), so in the above Irule we wanted to remove the pool part and to introduce Data-Group.
So, breaking the Irule:
The below part will remain same:
when CLIENT_ACCEPTED { set default_pool [LB::server pool] log local0. "Default pool [LB::server pool] set" log local0. "Client IP is [IP::remote_addr]" }
when HTTP_REQUEST { set https_uri [string tolower [HTTP::uri]] log local0. "requested [HTTP::uri]" if {$https_uri equals "/" } { HTTP::redirect "https://parveez.com" pool pool_parveez.com log local0. "redirected from /"
return
After this part it should use the Data-group which will replace the pool part from Irule and replaced the same by Data-Group
} elseif { $https_uri starts_with "/iss_static" } {
log local0. "matched /iss_static"
pool pool_confarmsp.leni2.com_http
log local0. "pool_confarmsp.leni2.com_http defined, [LB::server pool] selected" return
} elseif { $https_uri starts_with "/"} { log local0. "URI starts with /"
pool pool_apuat_leni2.com_http
log local0. " pool_apuat_leni2.com_http defined, [LB::server pool] selected" return
} else {
log local0. "no match for rev. close connection"
pool pool_apuat_leni2.com_http }
}
Thanks and Regards Parveez