From 146eec83a2f4d11ab314350fe6ea6328be03cc45 Mon Sep 17 00:00:00 2001 From: Geno Date: Fri, 27 Nov 2020 13:48:46 +0100 Subject: [PATCH] fix: corsAll from endpoint to middleware --- templates/conf.d/00-default.toml | 8 ++++---- templates/conf.d/70-easy-proxy.toml | 7 +++++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/templates/conf.d/00-default.toml b/templates/conf.d/00-default.toml index 42955f4..d96ef13 100644 --- a/templates/conf.d/00-default.toml +++ b/templates/conf.d/00-default.toml @@ -2,7 +2,7 @@ scheme = "https" permanent = true [http.middlewares.corsAll.headers] - AccessControlAllowMethods= ["GET", "OPTIONS", "PUT"] - AccessControlAllowOrigin = "*" - AccessControlMaxAge = 100 - AddVaryHeader = true + accessControlAllowMethods= ["GET", "OPTIONS", "PUT"] + accessControlAllowOrigin = "origin-list-or-null" + accessControlMaxAge = 100 + addVaryHeader = true diff --git a/templates/conf.d/70-easy-proxy.toml b/templates/conf.d/70-easy-proxy.toml index 63560db..13fab05 100644 --- a/templates/conf.d/70-easy-proxy.toml +++ b/templates/conf.d/70-easy-proxy.toml @@ -20,9 +20,12 @@ [http.routers.{{r.name}}] rule = "{{ r.rule }}" {% if r.tls %} - entryPoints = ["websecure"{% if "corsAll" in r and r.corsAll %}, "corsAll"{% endif %}] + entryPoints = ["websecure"] {% 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 %} service = "{{r.name}}@file" {% if r.tls %}