ratelimit: Add ratelimit custom response headers (#4015)

- Ability to add custom response headers from ratelimit
    service/filter
  - For both (LimitStatus::OK and LimitStatus::OverLimit) custom
    headers are added if RLS service sends headers
  - For LimitStatus:OK, we temporarily store the headers and add
    them to the response (via Filter::encodeHeaders())

*Risk Level*: Low

*Testing*: unit and integration tests added. Verified with modified
 github.com/lyft/ratelimit service. Passes "bazel test //test/..." in
 Linux

Signed-off-by: Suresh Kumar <suresh@freshdesk.com>

Mirrored from https://github.com/envoyproxy/envoy @ 71152b710e3543732464fca57c8f07b7395de68d
pull/620/head
data-plane-api(CircleCI) 6 years ago
parent 34928fe3ad
commit ea5bba9e8e
  1. 2
      envoy/service/ratelimit/v2/BUILD
  2. 3
      envoy/service/ratelimit/v2/rls.proto

@ -7,6 +7,7 @@ api_proto_library_internal(
srcs = ["rls.proto"],
has_services = 1,
deps = [
"//envoy/api/v2/core:base",
"//envoy/api/v2/core:grpc_service",
"//envoy/api/v2/ratelimit",
],
@ -16,6 +17,7 @@ api_go_grpc_library(
name = "rls",
proto = ":rls",
deps = [
"//envoy/api/v2/core:base_go_proto",
"//envoy/api/v2/core:grpc_service_go_proto",
"//envoy/api/v2/ratelimit:ratelimit_go_proto",
],

@ -3,6 +3,7 @@ syntax = "proto3";
package envoy.service.ratelimit.v2;
option go_package = "v2";
import "envoy/api/v2/core/base.proto";
import "envoy/api/v2/ratelimit/ratelimit.proto";
import "validate/validate.proto";
@ -75,4 +76,6 @@ message RateLimitResponse {
// in the RateLimitRequest. This can be used by the caller to determine which individual
// descriptors failed and/or what the currently configured limits are for all of them.
repeated DescriptorStatus statuses = 2;
// A list of headers to add to the response
repeated envoy.api.v2.core.HeaderValue headers = 3;
}

Loading…
Cancel
Save