Add origin header match support for rate limits
Rate limiting has the ability to be applied if the origin response
includes a HTTP header matching a specific value. This adds support for
using that functionality within the library (and later, Terraform
provider.)
Needed for terraform-providers/terraform-provider-cloudflare#196 to
proceed.
@@ -38,6 +38,15 @@ type RateLimitRequestMatcher struct {
type RateLimitResponseMatcher struct {
Statuses []int `json:"status,omitempty"`
OriginTraffic *bool `json:"origin_traffic,omitempty"` // api defaults to true so we need an explicit empty value
+ Headers []RateLimitResponseMatcherHeader `json:"headers,omitempty"`
+}
+
+// RateLimitResponseMatcherHeader contains the structure of the origin
+// HTTP headers used in request matcher checks.
+type RateLimitResponseMatcherHeader struct {
+ Name string `json:"name"`
+ Op string `json:"op"`
+ Value string `json:"value"`
}
// RateLimitKeyValue is k-v formatted as expected in the rate limit description
