mirror of
https://github.com/pomerium/pomerium.git
synced 2025-07-31 15:29:48 +02:00
envoy: implement set_request_headers (#673)
* proxy: implement preserve host header option * authorize: allow CORS preflight requests * proxy: add request headers
This commit is contained in:
parent
98d2f194a0
commit
ae3049baca
1 changed files with 13 additions and 0 deletions
|
@ -3,6 +3,7 @@ package controlplane
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
envoy_config_core_v3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
|
||||
envoy_config_route_v3 "github.com/envoyproxy/go-control-plane/envoy/config/route/v3"
|
||||
envoy_type_matcher_v3 "github.com/envoyproxy/go-control-plane/envoy/type/matcher/v3"
|
||||
"github.com/golang/protobuf/ptypes/any"
|
||||
|
@ -121,6 +122,17 @@ func (srv *Server) buildPolicyRoutes(options config.Options, domain string) []*e
|
|||
|
||||
clusterName, _, _ := srv.getClusterDetails(policy.Destination)
|
||||
|
||||
var requestHeadersToAdd []*envoy_config_core_v3.HeaderValueOption
|
||||
for k, v := range policy.SetRequestHeaders {
|
||||
requestHeadersToAdd = append(requestHeadersToAdd, &envoy_config_core_v3.HeaderValueOption{
|
||||
Header: &envoy_config_core_v3.HeaderValue{
|
||||
Key: k,
|
||||
Value: v,
|
||||
},
|
||||
Append: &wrappers.BoolValue{Value: false},
|
||||
})
|
||||
}
|
||||
|
||||
routes = append(routes, &envoy_config_route_v3.Route{
|
||||
Name: fmt.Sprintf("policy-%d", i),
|
||||
Match: match,
|
||||
|
@ -138,6 +150,7 @@ func (srv *Server) buildPolicyRoutes(options config.Options, domain string) []*e
|
|||
},
|
||||
},
|
||||
},
|
||||
RequestHeadersToAdd: requestHeadersToAdd,
|
||||
})
|
||||
}
|
||||
return routes
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue