From 0c15ec9f9d04c4c08d1df32d27fa00fa820ec3dc Mon Sep 17 00:00:00 2001 From: Francesco Antognazza Date: Tue, 7 Feb 2023 14:05:12 +0100 Subject: [PATCH] Update traefik container configuration --- containers/traefik/tasks.yml | 3 ++- containers/traefik/templates/conf/cockpit.yml.j2 | 10 +++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/containers/traefik/tasks.yml b/containers/traefik/tasks.yml index 1329382..a1d254f 100644 --- a/containers/traefik/tasks.yml +++ b/containers/traefik/tasks.yml @@ -102,8 +102,9 @@ 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`)" + traefik.http.routers.traefik.rule: "PathPrefix(`/traefik`) || HeadersRegexp(`Referer`, `.*/traefik/.*`)" traefik.http.routers.traefik.middlewares: "traefik-auth@docker" traefik.http.routers.traefik.tls: "true" traefik.http.routers.traefik.tls.certresolver: "wildcard" diff --git a/containers/traefik/templates/conf/cockpit.yml.j2 b/containers/traefik/templates/conf/cockpit.yml.j2 index 893fe28..a82ab1b 100644 --- a/containers/traefik/templates/conf/cockpit.yml.j2 +++ b/containers/traefik/templates/conf/cockpit.yml.j2 @@ -3,12 +3,20 @@ http: cockpit: rule: "PathPrefix(`/cockpit`)" entryPoints: https + middlewares: + - cockpit-stripprefix service: cockpit tls: certresolver: wildcard + middlewares: + cockpit-stripprefix: + stripPrefix: + prefixes: + - "/cockpit" + services: cockpit: loadBalancer: servers: - - url: "http://{{ ansible_host }}:9090" + - url: "http://127.0.0.1:9090"