Forum Discussion
Need to use datagroup in content of site
Hi ,
I am using below Irule to check URI and display content. Now i want to use Datagroup for that as there are many URLs. I have below sample code.
if { [HTTP::uri] starts_with "/mypage-abcd.htm" } {
HTTP::respond 200 content {abcd}
return 0
}Now i want to display the content from datagroup to {abcd}.
Datagroup My_Content
abcd bcde cdef
Now It should display all content respectively. Like if page is mypage-bcde.htm then content should be {bcde}
Can somebody help me to write the code. I am very new to this.
2 Replies
- Kevin_Stewart
Employee
You can certainly do it with data groups, but it starts to get hairy when you have a lot of HTML content to display. The better option is probably to use iFiles. Please see the following for some really good examples:
https://devcentral.f5.com/wiki/iRules.iFile.ashx
https://devcentral.f5.com/articles/v111-ndashexternal-file-access-from-irules-via-ifiles
- Kevin_Stewart
Employee
Just one more question. Can i use datagroup in URI in IF condition?
Datagroups are accessed with class commands, so is this what you're looking for?
when HTTP_REQUEST { if { [class match [string tolower [HTTP::uri]] equals uri_dg] } { do something } }
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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