fix: corsAll from endpoint to middleware

This commit is contained in:
Geno 2020-11-27 13:48:46 +01:00
parent 09007a88bb
commit 146eec83a2
2 changed files with 9 additions and 6 deletions

View File

@ -2,7 +2,7 @@
scheme = "https" scheme = "https"
permanent = true permanent = true
[http.middlewares.corsAll.headers] [http.middlewares.corsAll.headers]
AccessControlAllowMethods= ["GET", "OPTIONS", "PUT"] accessControlAllowMethods= ["GET", "OPTIONS", "PUT"]
AccessControlAllowOrigin = "*" accessControlAllowOrigin = "origin-list-or-null"
AccessControlMaxAge = 100 accessControlMaxAge = 100
AddVaryHeader = true addVaryHeader = true

View File

@ -20,9 +20,12 @@
[http.routers.{{r.name}}] [http.routers.{{r.name}}]
rule = "{{ r.rule }}" rule = "{{ r.rule }}"
{% if r.tls %} {% if r.tls %}
entryPoints = ["websecure"{% if "corsAll" in r and r.corsAll %}, "corsAll"{% endif %}] entryPoints = ["websecure"]
{% else %} {% else %}
entryPoints = ["web"{% if "corsAll" in r and r.corsAll %}, "corsAll"{% endif %}] entryPoints = ["web"]
{% endif %}
{% if "corsAll" in r and r.corsAll %}
middlewares = ["corsAll"]
{% endif %} {% endif %}
service = "{{r.name}}@file" service = "{{r.name}}@file"
{% if r.tls %} {% if r.tls %}