mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-08-15 09:24:52 +03:00
Change Traefik media router rule generation to force priority
The web-secure-router could end up having priority over the web-media-router when the www subdomain was used. This fix adds the www subdomain to the web-media-router if it's also present in the web-secure-router rule. Traefik looks at the length of rules to determine priority when no explicit priority is set. The web-media-router needs to always have priority over the web-secure-router in order for the media files to be served.
This commit is contained in:
parent
13fe0478d7
commit
213f623b93
|
@ -60,7 +60,11 @@ http:
|
||||||
{%- if cookiecutter.cloud_provider == 'None' %}
|
{%- if cookiecutter.cloud_provider == 'None' %}
|
||||||
|
|
||||||
web-media-router:
|
web-media-router:
|
||||||
|
{%- if cookiecutter.domain_name.count('.') == 1 %}
|
||||||
|
rule: "(Host(`{{ cookiecutter.domain_name }}`) || Host(`www.{{ cookiecutter.domain_name }}`))&& PathPrefix(`/media/`)"
|
||||||
|
{%- else %}
|
||||||
rule: "Host(`{{ cookiecutter.domain_name }}`) && PathPrefix(`/media/`)"
|
rule: "Host(`{{ cookiecutter.domain_name }}`) && PathPrefix(`/media/`)"
|
||||||
|
{%- endif %}
|
||||||
entryPoints:
|
entryPoints:
|
||||||
- web-secure
|
- web-secure
|
||||||
middlewares:
|
middlewares:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user