From 9cf47898f41b135b390f5e27c9c52b4a85fe6a8d Mon Sep 17 00:00:00 2001 From: Sudarshan Wadkar Date: Fri, 24 Apr 2020 14:00:27 +0530 Subject: [PATCH] Only consider TLDs while adding `www` route Instead of checking for `.co.XX` on best effort basis, we only check for the single dot in the domain_name indicating no subdomain usage. --- .../compose/production/traefik/traefik.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/{{cookiecutter.project_slug}}/compose/production/traefik/traefik.yml b/{{cookiecutter.project_slug}}/compose/production/traefik/traefik.yml index 5ff2e363..cfd566a8 100644 --- a/{{cookiecutter.project_slug}}/compose/production/traefik/traefik.yml +++ b/{{cookiecutter.project_slug}}/compose/production/traefik/traefik.yml @@ -26,10 +26,9 @@ certificatesResolvers: entryPoint: web http: - {%- set domain_dots = cookiecutter.domain_name.count('.') %} routers: web-router: - {%- if domain_dots == 1 or (domain_dots == 2 and '.co.' in cookiecutter.domain_name) %} + {%- if cookiecutter.domain_name.count('.') == 1 %} rule: "Host(`{{ cookiecutter.domain_name }}`) || Host(`www.{{ cookiecutter.domain_name }}`)" {% else %} rule: "Host(`{{ cookiecutter.domain_name }}`)" @@ -42,7 +41,7 @@ http: service: django web-secure-router: - {%- if domain_dots == 1 or (domain_dots == 2 and '.co.' in cookiecutter.domain_name) %} + {%- if cookiecutter.domain_name.count('.') == 1 %} rule: "Host(`{{ cookiecutter.domain_name }}`) || Host(`www.{{ cookiecutter.domain_name }}`)" {% else %} rule: "Host(`{{ cookiecutter.domain_name }}`)"