1
- # caddyv2-upload
1
+ = caddyv2-upload
2
+ :toc:
2
3
3
4
This repo holds a simple caddyserver v2 upload handler
4
5
@@ -12,9 +13,9 @@ In this handler are the following modules in use.
12
13
* github.com/caddyserver/jsonc-adapter
13
14
* upload :-)
14
15
15
- ## Configuration
16
+ == Configuration
16
17
17
- ### Parameters
18
+ === Parameters
18
19
19
20
[cols="2,6",options=header]
20
21
|===
@@ -50,10 +51,10 @@ In this handler are the following modules in use.
50
51
|This is the Parameter where you can define the CA for the **notify_url**.
51
52
|===
52
53
53
- ### JSON
54
+ === JSON
54
55
55
56
Because I prefer the https://caddyserver.com/docs/json/[JSON Config ]
56
- will I write here the config in JSON Syntax.
57
+ will I write here the configuration snipplet in JSON Syntax.
57
58
58
59
[source,json]
59
60
----
@@ -72,7 +73,7 @@ will I write here the config in JSON Syntax.
72
73
A full working example is in
73
74
`docker-files/opt/webroot/config/Caddyfile-upload.json`
74
75
75
- ### Caddyfile
76
+ === Caddyfile
76
77
77
78
Here a example Caddyfile which expects that the environment variable
78
79
`APPPORT` is set.
@@ -95,7 +96,7 @@ Here a example Caddyfile which expects that the environment variable
95
96
@mypost method POST
96
97
upload @mypost {
97
98
dest_dir tmp-upl
98
- max_form_buffer 1G
99
+ max_form_buffer 1G
99
100
max_filesize 4MB
100
101
response_template templates/upload-resp-template.txt
101
102
}
@@ -106,7 +107,7 @@ Here a example Caddyfile which expects that the environment variable
106
107
}
107
108
----
108
109
109
- ## build
110
+ == build
110
111
111
112
[source,shell]
112
113
---
@@ -115,9 +116,9 @@ xcaddy build --with github.com/kirsch33/realip \
115
116
--with github.com/git001/caddyv2-upload
116
117
---
117
118
118
- ## run
119
+ == run
119
120
120
- ### cli
121
+ === cli
121
122
122
123
[source,shell]
123
124
---
@@ -126,7 +127,7 @@ APPPORT=:2011 ./caddy run \
126
127
-config Caddyfile-upload.json
127
128
---
128
129
129
- ### docker
130
+ === docker
130
131
131
132
You can get this image from docker hub
132
133
@@ -146,7 +147,7 @@ docker run --name caddy-test --rm \
146
147
docker.io/me2digital/caddyv2-upload:latest
147
148
---
148
149
149
- ## example cli
150
+ == example cli
150
151
151
152
When you run the Image with port 8888 can you use curl or any other
152
153
tool to post (upload) files
@@ -191,4 +192,9 @@ http.request.host {{placeholder "http.request.host" }}
191
192
192
193
http.upload.filename: {{placeholder "http.upload.filename"}}
193
194
http.upload.filesize: {{placeholder "http.upload.filesize"}}
194
- ----
195
+ ----
196
+
197
+ == Background informations
198
+
199
+ The **max_form_buffer** paramater will be directly passed to https://cs.opensource.google/go/go/+/refs/tags/go1.18.2:src/mime/multipart/formdata.go;l=34;drc=7791e934c882fd103357448aee0fd577b20013ce[readForm] function and is used to check if the uploaded file should be saved temporarly on disk or keep it in the memory. This have dicret impact into the performance and disk usage of that module. Keep in mind when this paramter is low and the upload is a big file then will be there a lot of disk io.
200
+
0 commit comments