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

39 lines
1022 B
TOML
Raw Normal View History

2020-11-27 12:39:51 +01:00
{% 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 %}
2020-11-27 12:58:56 +01:00
entryPoints = ["websecure"{% if "corsAll" in r and r.corsAll %}, "corsAll"{% endif %}]
2020-11-27 12:39:51 +01:00
{% else %}
2020-11-27 12:58:56 +01:00
entryPoints = ["web"{% if "corsAll" in r and r.corsAll %}, "corsAll"{% endif %}]
2020-11-27 12:39:51 +01:00
{% 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 %}