4
4
level debug
5
5
}
6
6
cache {
7
- simplefs {
8
- configuration {
9
- size 10
10
- path storage
11
- }
7
+ allowed_http_verbs GET POST
8
+ api {
9
+ prometheus
10
+ souin
11
+ }
12
+ cdn {
13
+ dynamic
14
+ strategy hard
15
+ }
16
+ regex {
17
+ exclude /test2.*
18
+ }
19
+ ttl 1000s
20
+ timeout {
21
+ backend 10s
22
+ cache 100ms
12
23
}
13
- ttl 10s
14
24
default_cache_control public
15
25
}
16
26
}
17
27
18
28
:4443
19
29
respond "Hello World!"
20
30
21
- route /simplefs-configuration {
31
+ @match path /test1*
32
+ @match2 path /test2*
33
+ @matchdefault path /default
34
+ @souin-api path /souin-api*
35
+
36
+ cache @match {
37
+ ttl 5s
38
+ }
39
+
40
+ cache @match2 {
41
+ ttl 50s
42
+ }
43
+
44
+ cache @matchdefault {
45
+ ttl 5s
46
+ }
47
+
48
+ route /badger-configuration {
49
+ cache {
50
+ ttl 15s
51
+ badger {
52
+ configuration {
53
+ Dir /tmp/badger-configuration
54
+ ValueDir match2
55
+ ValueLogFileSize 167 77216
56
+ MemTableSize 419 4304
57
+ ValueThreshold 524 288
58
+ }
59
+ }
60
+ }
61
+ respond "Hello badger"
62
+ }
63
+
64
+ route /etcd {
65
+ cache {
66
+ ttl 5s
67
+ etcd {
68
+ configuration {
69
+ Endpoints etcd1:2379 etcd2:2379 etcd3:2379
70
+ AutoSyncInterval 1s
71
+ DialTimeout 1s
72
+ DialKeepAliveTime 1s
73
+ DialKeepAliveTimeout 1s
74
+ MaxCallSendMsgSize 100 00000
75
+ MaxCallRecvMsgSize 100 00000
76
+ Username john
77
+ Password doe
78
+ RejectOldCluster false
79
+ PermitWithoutStream false
80
+ }
81
+ }
82
+ }
83
+ respond "Hello etcd"
84
+ }
85
+
86
+ route /etcd-configuration {
87
+ cache {
88
+ ttl 5s
89
+ etcd {
90
+ configuration {
91
+ Endpoints etcd:2379 etcd:2379
92
+ AutoSyncInterval 1s
93
+ DialTimeout 1s
94
+ DialKeepAliveTime 1s
95
+ DialKeepAliveTimeout 1s
96
+ MaxCallSendMsgSize 100 00000
97
+ MaxCallRecvMsgSize 100 00000
98
+ RejectOldCluster false
99
+ PermitWithoutStream false
100
+ }
101
+ }
102
+ }
103
+ respond "Hello etcd"
104
+ }
105
+
106
+ route /nats {
107
+ cache {
108
+ ttl 5s
109
+ nats {
110
+ url nats://127.0.0.1:4222
111
+ }
112
+ }
113
+ respond "Hello nats"
114
+ }
115
+
116
+ route /nats-configuration {
117
+ cache {
118
+ ttl 5s
119
+ nats {
120
+ configuration {
121
+ Servers nats://127.0.0.1:4222
122
+ }
123
+ }
124
+ }
125
+ respond "Hello nats"
126
+ }
127
+
128
+ route /nuts-configuration {
129
+ cache {
130
+ ttl 15s
131
+ nuts {
132
+ configuration {
133
+ Dir /tmp/nuts-configuration
134
+ EntryIdxMode 1
135
+ RWMode 0
136
+ SegmentSize 102 4
137
+ NodeNum 42
138
+ SyncEnable true
139
+ StartFileLoadingMode 1
140
+ }
141
+ }
142
+ }
143
+ respond "Hello nuts"
144
+ }
145
+
146
+ route /redis {
147
+ cache {
148
+ ttl 5s
149
+ redis {
150
+ configuration {
151
+ ClientName souin-redis
152
+ InitAddress 127.0.0.1:6379
153
+ SelectDB 0
154
+ }
155
+ }
156
+ }
157
+ respond "Hello redis"
158
+ }
159
+
160
+ route /redis-configuration {
161
+ cache {
162
+ ttl 5s
163
+ redis {
164
+ configuration {
165
+ ClientName souin-redis
166
+ InitAddress 127.0.0.1:6379
167
+ SelectDB 0
168
+ }
169
+ }
170
+ }
171
+ respond "Hello redis"
172
+ }
173
+
174
+ route /redis-url {
175
+ cache {
176
+ ttl 5s
177
+ redis {
178
+ url 127.0.0.1:6379
179
+ }
180
+ }
181
+ respond "Hello redis url"
182
+ }
183
+
184
+ route /vary {
185
+ cache {
186
+ ttl 15s
187
+ }
188
+ header Vary X-Something
189
+ respond "Hello {http.request.header.X-Something}"
190
+ }
191
+
192
+ route /cache-s-maxage {
193
+ cache
194
+ header Cache-Control "s-maxage=10"
195
+ respond "Hello, s-maxage!"
196
+ }
197
+
198
+ route /cache-maxage {
199
+ cache
200
+ header Cache-Control "max-age=5"
201
+ respond "Hello, max-age!"
202
+ }
203
+
204
+ route /cache-maxstale {
205
+ cache {
206
+ ttl 3s
207
+ stale 5s
208
+ }
209
+ header Cache-Control "max-age=5"
210
+ respond "Hello, max-age!"
211
+ }
212
+
213
+ route /not-modified {
214
+ cache {
215
+ ttl 5s
216
+ }
217
+ reverse_proxy 127.0.0.1:9000
218
+ }
219
+
220
+ route /no-reverse-proxy {
221
+ cache
222
+ reverse_proxy 127.0.0.1:9000
223
+ }
224
+
225
+ route /surrogate-keys {
22
226
cache
23
- respond "Hello simplefs"
227
+ header Surrogate-Key "KEY-{http.request.header.X-Surrogate-Key-Suffix}"
228
+ header Vary X-Surrogate-Key-Suffix,Accept-Encoding
229
+ respond "Hello {http.request.header.X-Surrogate-Key-Suffix}"
24
230
}
231
+
232
+ route /another-cache-status-name {
233
+ cache {
234
+ cache_name Another
235
+ }
236
+ }
237
+
238
+ route /backend-timeout {
239
+ cache {
240
+ timeout {
241
+ backend 1s
242
+ cache 1ms
243
+ }
244
+ }
245
+ reverse_proxy 127.0.0.1:8081
246
+ }
247
+
248
+ route /stream {
249
+ cache
250
+ reverse_proxy 127.0.0.1:81
251
+ }
252
+
253
+ route /gzip {
254
+ cache
255
+ encode {
256
+ gzip
257
+ minimum_length 5
258
+ }
259
+ header Content-Type text/plain
260
+ respond "Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip. Hello, gzip."
261
+ }
262
+
263
+ route /custom-key/without-* {
264
+ cache {
265
+ cache_keys {
266
+ body {
267
+ disable_body
268
+ }
269
+ host {
270
+ disable_host
271
+ }
272
+ method {
273
+ disable_method
274
+ }
275
+ everything-with-content-type {
276
+ disable_method
277
+ headers Content-Type
278
+ }
279
+ }
280
+ }
281
+ respond "Hello to the authenticated user."
282
+ }
283
+
284
+ route /must-revalidate {
285
+ cache {
286
+ ttl 5s
287
+ stale 5s
288
+ }
289
+ header Cache-Control "must-revalidate"
290
+ reverse_proxy 127.0.0.1:81
291
+ }
292
+
293
+ route /cache-authorization {
294
+ cache {
295
+ cache_keys {
296
+ /. + {
297
+ headers Authorization
298
+ }
299
+ }
300
+ }
301
+ header Souin-Cache-Control public
302
+ respond "Hello to the authenticated user."
303
+ }
304
+
305
+ route /bypass {
306
+ cache {
307
+ mode bypass
308
+ }
309
+
310
+ header Cache-Control "no-store"
311
+ respond "Hello bypass"
312
+ }
313
+
314
+ route /bypass_request {
315
+ cache {
316
+ mode bypass_request
317
+ }
318
+
319
+ respond "Hello bypass_request"
320
+ }
321
+
322
+ route /bypass_response {
323
+ cache {
324
+ mode bypass_response
325
+ }
326
+
327
+ header Cache-Control "no-cache, no-store"
328
+ respond "Hello bypass_response"
329
+ }
330
+
331
+ route /strict_request {
332
+ cache {
333
+ mode strict
334
+ }
335
+
336
+ respond "Hello strict"
337
+ }
338
+
339
+ route /strict_response {
340
+ cache {
341
+ mode strict
342
+ }
343
+
344
+ header Cache-Control "no-cache, no-store"
345
+ respond "Hello strict"
346
+ }
347
+
348
+ cache @souin-api {
349
+ }
350
+
351
+ # ESI part
352
+ route /esi-include {
353
+ cache
354
+ header Content-Type text/html
355
+ respond "<h1>ESI INCLUDE</h1>"
356
+ }
357
+
358
+ route /alt-esi-include {
359
+ cache
360
+ header Content-Type text/html
361
+ respond "<h1>ALTERNATE ESI INCLUDE</h1>"
362
+ }
363
+
364
+ route /esi {
365
+ cache
366
+ header Content-Type text/html
367
+ respond `<esi:include src="http://localhost:4443/esi-include" alt=http://localhost:4443/alt-esi-include />`
368
+ }
0 commit comments