Forum Discussion
Data group field accessible to iRule?
Hello,
I have an iRule that's working fine to validate a variable containing the http header variable Origin to values defined in a data group.
if { [ class match [string tolower $request_origin ] starts_with dg_sb_fit1_allow_origin ] } ...
I now have a need to compare the Referer header variable to that same data group. If the "starts_with" is a match, I was going to simply take the value from the data group rather than parsing the Referer down to just the domain (stripping off the URL/query string, etc.). I've been trying a number of variations of the following, but have not been able to get the value from the data group.
set dg_origin [class match -value $request_referer starts_with dg_sb_fit1_allow_origin]
I then log $dg_origin, expecting the likes of "; (value from the data group), but getting blanks. I suspect a syntax issue, but I've been trying variations to no avail.
Or would I be better off parsing the Referer variable from the start up to the "/" after the domain?
Regards, Scott
2 Replies
- Vijay_E
Cirrus
Does your data-group dg_sb_fit1_allow_origin have key-value pair or just key ? You may want to avoid using "-value" if you just have one column of data in the datagroup. If I am mistaken, it will be good to see an example of your datagroup with made-up data but something that resembles your datagroup.
I believe the answer is pretty simple here. Use
instead of-name
.-valueIn this rule, the variable
isORIGIN
to the returned value and checks to see if it's blank at the same time.setset REFERER [string tolower [HTTP::header value Referer]] if { [set ORIGIN [class match -name $REFERER starts_with dg_sb_fit1_allow_origin]] ne "" } { log local0. "You matched ${ORIGIN}" }
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