Thanks all!
Here is my updated iRule:
when HTTP_REQUEST {
set uri [string tolower [HTTP::uri]]
if { ($uri contains "font") && ($uri ends_with ".eot" || $uri ends_with ".ttf" || $uri ends_with ".svg" || $uri ends_with ".woff") } {
log local0. "uri matches font and allowed extensions"
set headerstr [string tolower [HTTP::header "Referer"]]
if { $headerstr contains ".abc.com" || $headerstr contains ".xyz.com" || $headerstr contains ""} {
set referer { [HTTP::header "Referer"] }
log local0. "referer variable set to $referer"
set origin { [HTTP::header "Origin"] }
log local0. "origin variable set to $origin"
} else { HTTP::respond 403 content "403 - Forbidden"
log local0. "403 sent to client"
}
}
}
when HTTP_RESPONSE {
if { [$origin exists] } {
HTTP::header insert Access-Control-Allow-Origin [$origin]
}
}
If not the referer, what other option is there since referer is easily spoofed? I am using the origin header in my responses but it is not always present in requests.
Thanks again for all your help!
Myles