99)
1010
1111// Config defines the config for middleware.
12- //
13- //nolint:govet // struct layout favors readability/grouping over field alignment
1412type Config struct {
1513 // Next defines a function to skip this middleware when returned true.
1614 //
@@ -35,6 +33,13 @@ type Config struct {
3533 // and DialDualStack will not be used if the client are set.
3634 Client * fasthttp.LBClient
3735
36+ // SecurityPolicy overrides the default SSRF, redirect, and
37+ // hop-by-hop header rules for this balancer. When nil, the
38+ // package-level policy set via WithSecurityPolicy is used.
39+ //
40+ // Optional. Default: nil
41+ SecurityPolicy * SecurityPolicy
42+
3843 // Servers defines a list of <scheme>://<host> HTTP servers,
3944 //
4045 // which are used in a round-robin manner.
@@ -62,6 +67,14 @@ type Config struct {
6267 // Per-connection buffer size for responses' writing.
6368 WriteBufferSize int
6469
70+ // MaxResponseBodySize bounds the size (in bytes) of upstream
71+ // responses accepted by the proxy. Responses larger than this are
72+ // rejected to protect the proxy from memory exhaustion. Zero
73+ // preserves fasthttp's default unlimited behavior.
74+ //
75+ // Optional. Default: 0
76+ MaxResponseBodySize int
77+
6578 // KeepConnectionHeader keeps the "Connection" header when set to true.
6679 //
6780 // Note: even when KeepConnectionHeader is true, other RFC 7230 §6.1
@@ -80,21 +93,6 @@ type Config struct {
8093 //
8194 // Optional. Default: false
8295 DialDualStack bool
83-
84- // SecurityPolicy overrides the default SSRF, redirect, and
85- // hop-by-hop header rules for this balancer. When nil, the
86- // package-level policy set via WithSecurityPolicy is used.
87- //
88- // Optional. Default: nil
89- SecurityPolicy * SecurityPolicy
90-
91- // MaxResponseBodySize bounds the size (in bytes) of upstream
92- // responses accepted by the proxy. Responses larger than this are
93- // rejected to protect the proxy from memory exhaustion. Zero
94- // preserves fasthttp's default unlimited behavior.
95- //
96- // Optional. Default: 0
97- MaxResponseBodySize int
9896}
9997
10098const defaultMaxConnsPerHost = 1024
0 commit comments