Skip to content

Commit fc3fcf3

Browse files
Andrew Farriesroboquat
Andrew Farries
authored andcommitted
Extract request matchers to snippet
1 parent 2071284 commit fc3fcf3

File tree

1 file changed

+13
-21
lines changed

1 file changed

+13
-21
lines changed

components/proxy/conf/Caddyfile

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,16 @@
128128
}
129129
}
130130

131+
(slow_fast_matchers) {
132+
@slow {
133+
header X-Gitpod-Slow-Database "true"
134+
}
135+
136+
@fast {
137+
not header X-Gitpod-Slow-Database "true"
138+
}
139+
}
140+
131141
# Kubernetes health-check
132142
:8003 {
133143
respond /live 200
@@ -223,13 +233,7 @@ https://{$GITPOD_DOMAIN} {
223233
copy_headers X-Gitpod-Slow-Database
224234
}
225235

226-
@slow {
227-
header X-Gitpod-Slow-Database "true"
228-
}
229-
230-
@fast {
231-
not header X-Gitpod-Slow-Database "true"
232-
}
236+
import slow_fast_matchers
233237

234238
uri strip_prefix /api
235239

@@ -255,13 +259,7 @@ https://{$GITPOD_DOMAIN} {
255259
copy_headers X-Gitpod-Slow-Database
256260
}
257261

258-
@slow {
259-
header X-Gitpod-Slow-Database "true"
260-
}
261-
262-
@fast {
263-
not header X-Gitpod-Slow-Database "true"
264-
}
262+
import slow_fast_matchers
265263

266264
uri strip_prefix /api
267265

@@ -319,13 +317,7 @@ https://{$GITPOD_DOMAIN} {
319317
copy_headers X-Gitpod-Slow-Database
320318
}
321319

322-
@slow {
323-
header X-Gitpod-Slow-Database "true"
324-
}
325-
326-
@fast {
327-
not header X-Gitpod-Slow-Database "true"
328-
}
320+
import slow_fast_matchers
329321

330322
reverse_proxy @fast server.{$KUBE_NAMESPACE}.{$KUBE_DOMAIN}:3000 {
331323
import upstream_headers

0 commit comments

Comments
 (0)