@@ -21,12 +21,17 @@ var httpClient = &http.Client{
21
21
// Config the plugin configuration.
22
22
type Config struct {
23
23
ModSecurityUrl string `json:"modSecurityUrl,omitempty"`
24
- MaxBodySize int64 `json:"maxBodySize,omitempty "`
24
+ MaxBodySize int64 `json:"maxBodySize"`
25
25
}
26
26
27
27
// CreateConfig creates the default plugin configuration.
28
28
func CreateConfig () * Config {
29
- return & Config {}
29
+ return & Config {
30
+ // Safe default: if the max body size was not specified, use 10MB
31
+ // Note that this will break any file upload with files > 10MB. Hopefully
32
+ // the user will configure this parameter during the installation.
33
+ MaxBodySize : 10 * 1024 * 1024 ,
34
+ }
30
35
}
31
36
32
37
// Modsecurity a Modsecurity plugin.
@@ -44,15 +49,9 @@ func New(ctx context.Context, next http.Handler, config *Config, name string) (h
44
49
return nil , fmt .Errorf ("modSecurityUrl cannot be empty" )
45
50
}
46
51
47
- // Safe default: if the max body size was not specified, use 10MB
48
- // Note that this will break any file upload with files > 10MB. Hopefully
49
- // the user will configure this parameter during the installation.
50
- if config .MaxBodySize == 0 {
51
- config .MaxBodySize = 10 * 1024 * 1024
52
- }
53
-
54
52
return & Modsecurity {
55
53
modSecurityUrl : config .ModSecurityUrl ,
54
+ maxBodySize : config .MaxBodySize ,
56
55
next : next ,
57
56
name : name ,
58
57
logger : log .New (os .Stdout , "" , log .LstdFlags ),
0 commit comments