Commit 84e8436
committed
http: Support inferring X-Forwarded-Proto from PROXY protocol destination port (#43088)
When using Layer 4 load balancers (like AWS NLB) that terminate TLS and
forward traffic using PROXY protocol, Envoy receives unencrypted traffic
but needs to know the original protocol for correct redirect behavior.
This change adds a new HCM configuration option `forwarded_proto_config`
that allows specifying which PROXY protocol destination ports should be
treated as HTTPS or HTTP. When enabled and the local address was
restored from PROXY protocol, the `x-forwarded-proto` header is set
based on whether the destination port is in `https_destination_ports` or
`http_destination_ports`.
Example configuration:
```
http_connection_manager:
forwarded_proto_config:
https_destination_ports: [443, 8443]
http_destination_ports: [80, 8080]
```
Risk Level: Low - opt-in feature that only activates when explicitly
configured and when localAddressRestored() is true
Testing: Added 6 unit tests in conn_manager_utility_test.cc covering
port 443/80 mapping, unmapped ports, empty config, non-restored address,
and custom ports
Docs Changes: N/A
Release Notes: Added
Platform Specific Features:
[Optional Runtime guard:]
Fixes #43031
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
API Considerations: Added new message ForwardedProtoConfig and field
forwarded_proto_config (#61) to HttpConnectionManager. The configuration
uses two repeated uint32 fields (https_destination_ports and
http_destination_ports) for type-safe port specification without
requiring string validation.
---------
Signed-off-by: Prashanth Josyula <prashanth.16@gmail.com>
Mirrored from https://github.com/envoyproxy/envoy @ f126920c1c3443175680bdc88c55116b979d396f1 parent 7468956 commit 84e8436
1 file changed
Lines changed: 44 additions & 1 deletion
Lines changed: 44 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| |||
1051 | 1051 | | |
1052 | 1052 | | |
1053 | 1053 | | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
1054 | 1097 | | |
1055 | 1098 | | |
1056 | 1099 | | |
| |||
0 commit comments