---
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
  name: {{ ternary (printf "%v-%v" $.Release.Name "tc-nextcloud-redirectregex-dav") "tc-nextcloud-redirectregex-dav" $.Values.ingressClass.enabled }}
  namespace: {{ $.Release.Namespace }}
spec:
  redirectRegex:
    regex: "https://(.*)/.well-known/(card|cal)dav"
    replacement: "https://${1}/remote.php/dav/"
---
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
  name: {{ ternary (printf "%v-%v" $.Release.Name "tc-nextcloud-chain") "tc-nextcloud-chain" $.Values.ingressClass.enabled }}
  namespace: {{ $.Release.Namespace }}
spec:
  chain:
    middlewares:
    - name: {{ ternary (printf "%v-%v" $.Release.Name "tc-nextcloud-redirectregex-dav") "tc-nextcloud-redirectregex-dav" $.Values.ingressClass.enabled }}
