Forum Discussion
bjtstarks_26108
Nimbostratus
Jan 15, 2019How to use Lists in iRule
I'm trying to do a redirect to a specific node for a specific set of sites using our F5. I can do a single site easily using the following irule:
when HTTP_REQUEST {
if { [string tolower [HTT...
Dave_McCauley_3
Cirrostratus
Jan 15, 2019Check this out:
https://devcentral.f5.com/articles/intermediate-irules-data-groups-20430
You need to take the contents of the file you imported and set it to the key/values in the datagroup.
ltm data-group internal my_datagroup {
records {
site1.mysite.com {
data 10.1.1.31
}
site2.mysite.com {
data 10.1.1.32
}
...
site130.mysite.com {
data 10.1.1.130
}
}
type string
}
Then you can do a single statement like:
if { [class match [string tolower [HTTP::host]] equals "my_datagroup" ] } {
node [class match -value [string tolower [HTTP::host]] equals "my_datagroup"
}
You could add the records in via the GUI or tmsh, or create the file like that and merge it in, or even add it to the bigip.conf and just to a tmsh load sys config.
bjtstarks_26108
Nimbostratus
Jan 16, 2019This looks like what I was looking for. Thanks! I'll give it a try and let you know how it goes.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
