http: middlewares: default-headers: headers: {{ traefik_headers | to_nice_yaml | indent(8) }} {% if traefik_dynamic_middlewares %} # Additional middlewares from hostvars {% for mw_name, mw_conf in traefik_dynamic_middlewares.items() %} {{ mw_name }}: {{ mw_conf | to_nice_yaml | indent(6) }} {% endfor %} {% endif %} {% set dashboard_auth_enabled = (traefik_dashboard_basicauth_users | default([])) if traefik_dashboard_enabled | bool else [] %} {% if dashboard_auth_enabled %} # basicAuth for the dashboard router (traefik_dashboard_basicauth_users) dashboard-auth: basicAuth: users: {% for user in dashboard_auth_enabled %} - {{ user | to_json }} {% endfor %} {% endif %} {% if traefik_dashboard_enabled | bool or traefik_dynamic_apps %} routers: {% endif %} {% if traefik_dashboard_enabled | bool %} dashboard: rule: "Host(`{{ traefik_dashboard_subdomain }}{{ traefik_domain }}`)" service: api@internal middlewares: - dashboard-auth@file entryPoints: - web - websecure tls: certResolver: cloudflare {% endif %} {% if traefik_dynamic_apps %} # Routers for additional apps {% for app in traefik_dynamic_apps %} {{ app.service_name }}: rule: "Host(`{{ app.subdomain }}{{ traefik_domain }}`)" service: "{{ app.service_name }}" entryPoints: - web - websecure tls: certResolver: cloudflare {% endfor %} {% endif %} {% if traefik_dynamic_apps %} # Services for additional apps services: {% for app in traefik_dynamic_apps %} {{ app.service_name }}: loadBalancer: servers: - url: "{{ app.server_url }}" passHostHeader: {{ app.pass_host_header | default(true) | lower }} {% endfor %} {% endif %}