fix: drop k3s-traefik priority, wrap caddy web reverse_proxy in handle
The k3s-traefik IngressRoute was emitting priority: len(path) on the route rule but no priority on the bare-Host catch-all. Traefik defaults missing priority to rule length, so the catch-all rule got ~32 while the path rule got 7, and the catch-all always won. Same exact priority bug we fixed for docker-traefik. Dropping the priority line lets traefik use its rule-length default which gives longest-prefix-wins naturally because Host && PathPrefix is always longer than bare Host. The caddy web container's emission was a bare reverse_proxy directive that runs at caddy default order ~190, well before the handle directive at ~210 where my route emission lives. The bare reverse_proxy caught every request including paths intended for the route. When at least one route exists for the app, the web container now wraps its reverse_proxy in a catch-all handle block via caddy.9_handle.0_reverse_proxy=...; both the route's handle (at 0_) and web's catch-all (at 9_) live at the same directive order ~210 and caddy's mutually-exclusive handle logic picks the route handle for matched paths and the catch-all for everything else. The "9_" prefix orders web's catch-all after the route handles in the docker-proxy generated Caddyfile. Apps without routes keep the original bare reverse_proxy behaviour.
This commit is contained in:
3 files changed
+31
-11
No files matched your search
@@ -41,7 +41,9 @@ spec:
|
||||
{{- range $rdx, $route := $.Values.global.network.routes }}
|
||||
- kind: Rule
|
||||
match: Host(`{{ $domain.name }}`) && PathPrefix(`{{ $route.path }}`)
|
||||
priority: {{ len $route.path }}
|
||||
# No explicit priority - traefik's default (rule length) gives
|
||||
# longest-prefix-wins because Host(...) && PathPrefix(...) is always
|
||||
# longer than web's bare Host(...) rule below.
|
||||
middlewares:
|
||||
- name: {{ $.Values.global.app_name}}-{{ $processName }}-compression
|
||||
namespace: {{ $.Values.global.namespace }}
|
||||
|
||||
Reference in new issue
Block a user