@@ -13,19 +13,21 @@ import (
13
13
)
14
14
15
15
const (
16
- DeletionProtectionEnabledKey = "deletion_protection.enabled"
17
- AccessLogsS3EnabledKey = "access_logs.s3.enabled"
18
- AccessLogsS3BucketKey = "access_logs.s3.bucket"
19
- AccessLogsS3PrefixKey = "access_logs.s3.prefix"
20
- IdleTimeoutTimeoutSecondsKey = "idle_timeout.timeout_seconds"
21
- RoutingHTTP2EnabledKey = "routing.http2.enabled"
22
-
23
- DeletionProtectionEnabled = false
24
- AccessLogsS3Enabled = false
25
- AccessLogsS3Bucket = ""
26
- AccessLogsS3Prefix = ""
27
- IdleTimeoutTimeoutSeconds = 60
28
- RoutingHTTP2Enabled = true
16
+ DeletionProtectionEnabledKey = "deletion_protection.enabled"
17
+ AccessLogsS3EnabledKey = "access_logs.s3.enabled"
18
+ AccessLogsS3BucketKey = "access_logs.s3.bucket"
19
+ AccessLogsS3PrefixKey = "access_logs.s3.prefix"
20
+ IdleTimeoutTimeoutSecondsKey = "idle_timeout.timeout_seconds"
21
+ RoutingHTTP2EnabledKey = "routing.http2.enabled"
22
+ DropInvalidHeaderFieldsEnabledKey = "routing.http.drop_invalid_header_fields.enabled"
23
+
24
+ DeletionProtectionEnabled = false
25
+ AccessLogsS3Enabled = false
26
+ AccessLogsS3Bucket = ""
27
+ AccessLogsS3Prefix = ""
28
+ IdleTimeoutTimeoutSeconds = 60
29
+ RoutingHTTP2Enabled = true
30
+ DropInvalidHeaderFieldsEnabled = false
29
31
)
30
32
31
33
// Attributes represents the desired state of attributes for a load balancer.
@@ -55,16 +57,21 @@ type Attributes struct {
55
57
// RoutingHTTP2Enabled: routing.http2.enabled - Indicates whether HTTP/2 is enabled. The value
56
58
// is true or false. The default is true.
57
59
RoutingHTTP2Enabled bool
60
+
61
+ // DropInvalidHeaderFieldsEnabled: routing.http.drop_invalid_header_fields.enabled - Indicates if
62
+ // invalid headers will be dropped. The default is false.
63
+ DropInvalidHeaderFieldsEnabled bool
58
64
}
59
65
60
66
func NewAttributes (attrs []* elbv2.LoadBalancerAttribute ) (a * Attributes , err error ) {
61
67
a = & Attributes {
62
- DeletionProtectionEnabled : DeletionProtectionEnabled ,
63
- AccessLogsS3Enabled : AccessLogsS3Enabled ,
64
- AccessLogsS3Bucket : AccessLogsS3Bucket ,
65
- AccessLogsS3Prefix : AccessLogsS3Prefix ,
66
- IdleTimeoutTimeoutSeconds : IdleTimeoutTimeoutSeconds ,
67
- RoutingHTTP2Enabled : RoutingHTTP2Enabled ,
68
+ DeletionProtectionEnabled : DeletionProtectionEnabled ,
69
+ AccessLogsS3Enabled : AccessLogsS3Enabled ,
70
+ AccessLogsS3Bucket : AccessLogsS3Bucket ,
71
+ AccessLogsS3Prefix : AccessLogsS3Prefix ,
72
+ IdleTimeoutTimeoutSeconds : IdleTimeoutTimeoutSeconds ,
73
+ RoutingHTTP2Enabled : RoutingHTTP2Enabled ,
74
+ DropInvalidHeaderFieldsEnabled : DropInvalidHeaderFieldsEnabled ,
68
75
}
69
76
var e error
70
77
for _ , attr := range attrs {
@@ -97,6 +104,11 @@ func NewAttributes(attrs []*elbv2.LoadBalancerAttribute) (a *Attributes, err err
97
104
if err != nil {
98
105
return a , fmt .Errorf ("invalid load balancer attribute value %s=%s" , attrKey , attrValue )
99
106
}
107
+ case DropInvalidHeaderFieldsEnabledKey :
108
+ a .DropInvalidHeaderFieldsEnabled , err = strconv .ParseBool (attrValue )
109
+ if err != nil {
110
+ return a , fmt .Errorf ("invalid load balancer attribute value %s=%s" , attrKey , attrValue )
111
+ }
100
112
default :
101
113
e = NewInvalidAttribute (attrKey )
102
114
}
@@ -184,6 +196,10 @@ func attributesChangeSet(current, desired *Attributes) (changeSet []*elbv2.LoadB
184
196
changeSet = append (changeSet , lbAttribute (RoutingHTTP2EnabledKey , fmt .Sprintf ("%v" , desired .RoutingHTTP2Enabled )))
185
197
}
186
198
199
+ if current .DropInvalidHeaderFieldsEnabled != desired .DropInvalidHeaderFieldsEnabled {
200
+ changeSet = append (changeSet , lbAttribute (DropInvalidHeaderFieldsEnabledKey , fmt .Sprintf ("%v" , desired .DropInvalidHeaderFieldsEnabled )))
201
+ }
202
+
187
203
return
188
204
}
189
205
0 commit comments