Add more selective match to increase the regex precedence

This commit is contained in:
2023-02-15 14:00:52 +01:00
parent 0957ad5f1c
commit 71a8507928
9 changed files with 29 additions and 15 deletions

View File

@@ -0,0 +1,15 @@
http:
middlewares:
force-trailing-slash:
chain:
middlewares:
- add-trailing-slash
- strip-after-slash
add-trailing-slash:
redirectregex:
regex: "^(https?://[^/]+/[a-z0-9_]+)$"
replacement: "${1}/"
permanent: true
strip-after-slash:
stripprefixregex:
regex: "/[a-z0-9_]+"

View File

@@ -104,9 +104,8 @@
io.containers.autoupdate: "registry"
traefik.enable: "true"
traefik.http.middlewares.traefik-auth.basicauth.users: "{{ vault_traefik_basic_auth }}"
traefik.http.middlewares.traefik-prefixstrip.stripprefix.prefixes: "/traefik"
traefik.http.routers.traefik.entrypoints: "https"
traefik.http.routers.traefik.rule: "PathPrefix(`/traefik`) || HeadersRegexp(`Referer`, `.*/traefik/.*`)"
traefik.http.routers.traefik.rule: "Host(`{{ vault_domain }}`) && PathPrefix(`/api`,`/dashboard`)"
traefik.http.routers.traefik.middlewares: "traefik-auth@docker"
traefik.http.routers.traefik.tls: "true"
traefik.http.routers.traefik.tls.certresolver: "wildcard"

View File

@@ -1,10 +1,10 @@
http:
routers:
cockpit:
rule: "PathPrefix(`/cockpit`)"
rule: "Host(`{{ vault_domain }}`) && (PathPrefix(`/cockpit/`) || Path(`/cockpit`))"
entryPoints: https
middlewares:
- cockpit-stripprefix
- force-trailing-slash
service: cockpit
tls:
certresolver: wildcard