add rewrite_response_headers to protobuf (#1962)

This commit is contained in:
Caleb Doxsey 2021-03-05 13:57:27 -07:00 committed by GitHub
parent 7f6107051f
commit 46ae3cf358
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 708 additions and 563 deletions

View file

@ -249,6 +249,14 @@ func NewPolicyFromProto(pb *configpb.Route) (*Policy, error) {
p.EnvoyOpts.Name = pb.Name p.EnvoyOpts.Name = pb.Name
} }
for _, rwh := range pb.RewriteResponseHeaders {
p.RewriteResponseHeaders = append(p.RewriteResponseHeaders, RewriteHeader{
Header: rwh.GetHeader(),
Prefix: rwh.GetPrefix(),
Value: rwh.GetValue(),
})
}
for _, sp := range pb.GetPolicies() { for _, sp := range pb.GetPolicies() {
p.SubPolicies = append(p.SubPolicies, SubPolicy{ p.SubPolicies = append(p.SubPolicies, SubPolicy{
ID: sp.GetId(), ID: sp.GetId(),
@ -335,6 +343,16 @@ func (p *Policy) ToProto() (*configpb.Route, error) {
pb.LoadBalancingWeights = weights pb.LoadBalancingWeights = weights
} }
for _, rwh := range p.RewriteResponseHeaders {
pb.RewriteResponseHeaders = append(pb.RewriteResponseHeaders, &configpb.RouteRewriteHeader{
Header: rwh.Header,
Matcher: &configpb.RouteRewriteHeader_Prefix{
Prefix: rwh.Prefix,
},
Value: rwh.Value,
})
}
return pb, nil return pb, nil
} }

File diff suppressed because it is too large Load diff

View file

@ -14,6 +14,12 @@ message Config {
Settings settings = 3; Settings settings = 3;
} }
message RouteRewriteHeader {
string header = 1;
oneof matcher { string prefix = 3; }
string value = 2;
}
message RouteRedirect { message RouteRedirect {
optional bool https_redirect = 1; optional bool https_redirect = 1;
optional string scheme_redirect = 2; optional string scheme_redirect = 2;
@ -74,6 +80,7 @@ message Route {
map<string, string> set_request_headers = 22; map<string, string> set_request_headers = 22;
repeated string remove_request_headers = 23; repeated string remove_request_headers = 23;
repeated RouteRewriteHeader rewrite_response_headers = 40;
bool preserve_host_header = 24; bool preserve_host_header = 24;
bool pass_identity_headers = 25; bool pass_identity_headers = 25;