Skip to content

Commit d15b638

Browse files
committed
Add health handler into Caddyfile-upload and save the file in unix format
1 parent ab1781a commit d15b638

File tree

1 file changed

+142
-139
lines changed

1 file changed

+142
-139
lines changed
Lines changed: 142 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -1,139 +1,142 @@
1-
{
2-
"admin": {
3-
"listen": "127.0.0.1:8081"
4-
},
5-
"apps": {
6-
"http": {
7-
"grace_period": "30m",
8-
"servers": {
9-
"example": {
10-
"listen": ["{env.APPPORT}"],
11-
"logs": {
12-
"default_logger_name": "myaccesslogger"
13-
},
14-
"routes": [
15-
{
16-
"match":[
17-
{
18-
"method": ["GET"],
19-
"path": ["/health"]
20-
}
21-
],
22-
"handle": [
23-
{
24-
"handler": "static_response",
25-
"status_code": 200,
26-
"body": "Okay",
27-
"close": true
28-
}
29-
]
30-
},
31-
{
32-
"match":[
33-
{
34-
"method": ["GET"],
35-
"path": ["/print-headers-template.txt"]
36-
37-
}
38-
],
39-
"handle": [
40-
{
41-
"handler": "templates"
42-
},
43-
{
44-
"handler": "headers",
45-
"response": {
46-
"set": {
47-
"Content-Type": ["text/plain; charset=utf-8"]
48-
}
49-
}
50-
},
51-
{
52-
"handler": "file_server",
53-
"root": "templates"
54-
}
55-
]
56-
},
57-
{
58-
"match":[
59-
{
60-
"method": ["GET"],
61-
"path": ["/upload-template.html"]
62-
}
63-
],
64-
"handle": [
65-
{
66-
"handler": "templates"
67-
},
68-
{
69-
"handler": "file_server",
70-
"root": "templates"
71-
}
72-
]
73-
},
74-
{
75-
"match":[
76-
{
77-
"method": ["GET"]
78-
}
79-
],
80-
"handle": [
81-
{
82-
"handler": "templates"
83-
},
84-
{
85-
"handler": "file_server",
86-
"browse":
87-
{
88-
}
89-
}
90-
]
91-
},
92-
{
93-
"match":[
94-
{
95-
"method": ["POST"]
96-
}
97-
],
98-
"handle": [
99-
{
100-
"handler": "templates"
101-
},
102-
{
103-
"handler": "headers",
104-
"response": {
105-
"set": {
106-
"Content-Type": ["text/plain; charset=utf-8"]
107-
}
108-
}
109-
},
110-
{
111-
"MyTlsSetting": {},
112-
"dest_dir": "upload",
113-
"handler": "upload",
114-
"max_filesize": "{env.MAXFILESIZE}",
115-
"response_template":"templates/upload-resp-template.txt"
116-
}
117-
]
118-
}
119-
]
120-
}
121-
}
122-
}
123-
},
124-
"logging": {
125-
"logs": {
126-
"default": {
127-
"level": "INFO"
128-
},
129-
"myaccesslogger": {
130-
"writer": {
131-
"output": "stdout"
132-
},
133-
"encoder": {
134-
"format": "json"
135-
}
136-
}
137-
}
138-
}
139-
}
1+
{
2+
"admin": {
3+
"listen": "127.0.0.1:8081"
4+
},
5+
"apps": {
6+
"http": {
7+
"grace_period": "30m",
8+
"servers": {
9+
"example": {
10+
"listen": ["{env.APPPORT}"],
11+
"logs": {
12+
"default_logger_name": "myaccesslogger"
13+
},
14+
"routes": [
15+
{
16+
"match":[
17+
{
18+
"method": ["GET"],
19+
"path": ["/health"]
20+
}
21+
],
22+
"handle": [
23+
{
24+
"handler":"vars",
25+
"skip_log": "{env.SKIP_LOG}"
26+
},
27+
{
28+
"handler": "static_response",
29+
"status_code": 200,
30+
"body": "Okay",
31+
"close": true
32+
}
33+
]
34+
},
35+
{
36+
"match":[
37+
{
38+
"method": ["GET"],
39+
"path": ["/print-headers-template.txt"]
40+
}
41+
],
42+
"handle": [
43+
{
44+
"handler": "templates"
45+
},
46+
{
47+
"handler": "headers",
48+
"response": {
49+
"set": {
50+
"Content-Type": ["text/plain; charset=utf-8"]
51+
}
52+
}
53+
},
54+
{
55+
"handler": "file_server",
56+
"root": "templates"
57+
}
58+
]
59+
},
60+
{
61+
"match":[
62+
{
63+
"method": ["GET"],
64+
"path": ["/upload-template.html"]
65+
}
66+
],
67+
"handle": [
68+
{
69+
"handler": "templates"
70+
},
71+
{
72+
"handler": "file_server",
73+
"root": "templates"
74+
}
75+
]
76+
},
77+
{
78+
"match":[
79+
{
80+
"method": ["GET"]
81+
}
82+
],
83+
"handle": [
84+
{
85+
"handler": "templates"
86+
},
87+
{
88+
"handler": "file_server",
89+
"browse":
90+
{
91+
}
92+
}
93+
]
94+
},
95+
{
96+
"match":[
97+
{
98+
"method": ["POST"]
99+
}
100+
],
101+
"handle": [
102+
{
103+
"handler": "templates"
104+
},
105+
{
106+
"handler": "headers",
107+
"response": {
108+
"set": {
109+
"Content-Type": ["text/plain; charset=utf-8"]
110+
}
111+
}
112+
},
113+
{
114+
"MyTlsSetting": {},
115+
"dest_dir": "upload",
116+
"handler": "upload",
117+
"max_filesize": "{env.MAXFILESIZE}",
118+
"response_template":"templates/upload-resp-template.txt"
119+
}
120+
]
121+
}
122+
]
123+
}
124+
}
125+
}
126+
},
127+
"logging": {
128+
"logs": {
129+
"default": {
130+
"level": "INFO"
131+
},
132+
"myaccesslogger": {
133+
"writer": {
134+
"output": "stdout"
135+
},
136+
"encoder": {
137+
"format": "json"
138+
}
139+
}
140+
}
141+
}
142+
}

0 commit comments

Comments
 (0)