ansible-role-traefik/templates/conf.d/70-easy-proxy.toml

42 lines
982 B
TOML

{% for r in traefik_proxy %}
#---------------------------------
# {{ r.name }}: {{ r.rule }}
#---------------------------------
{% if r.tls %}
[http.routers.{{r.name}}-redir]
rule = "{{ r.rule }}"
entryPoints = ["web"]
middlewares = ["httpsRedirect"]
service = "{{r.name}}@file"
[http.routers.{{r.name}}-acme]
rule = "({{ r.rule }}) && PathPrefix(`/.well-known/acme-challenge/`)"
entryPoints = ["web"]
service = "{{r.name}}@file"
{% endif %}
[http.routers.{{r.name}}]
rule = "{{ r.rule }}"
{% if r.tls %}
entryPoints = ["websecure"]
{% else %}
entryPoints = ["web"]
{% endif %}
{% if "corsAll" in r and r.corsAll %}
middlewares = ["corsAll"]
{% endif %}
service = "{{r.name}}@file"
{% if r.tls %}
[http.routers.{{r.name}}.tls]
certResolver = "my-resolver"
{% endif %}
[http.services.{{ r.name }}.loadBalancer]
{% for url in r.service_url %}
[[http.services.{{ r.name }}.loadBalancer.servers]]
url = "{{ url }}"
{% endfor %}
{% endfor %}