mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2024-11-11 12:17:37 +03:00
Made Traefik conf much easier to understand and improved redirect response to entrypoint as opposed to middleware layer that is hit after entrypoint and routing layers.
This commit is contained in:
parent
d0ef737234
commit
35b89997ef
|
@ -5,6 +5,11 @@ entryPoints:
|
||||||
web:
|
web:
|
||||||
# http
|
# http
|
||||||
address: ":80"
|
address: ":80"
|
||||||
|
http:
|
||||||
|
redirections:
|
||||||
|
entryPoint:
|
||||||
|
to: web-secure
|
||||||
|
scheme: https
|
||||||
|
|
||||||
web-secure:
|
web-secure:
|
||||||
# https
|
# https
|
||||||
|
@ -27,19 +32,6 @@ certificatesResolvers:
|
||||||
|
|
||||||
http:
|
http:
|
||||||
routers:
|
routers:
|
||||||
web-router:
|
|
||||||
{%- if cookiecutter.domain_name.count('.') == 1 %}
|
|
||||||
rule: "Host(`{{ cookiecutter.domain_name }}`) || Host(`www.{{ cookiecutter.domain_name }}`)"
|
|
||||||
{% else %}
|
|
||||||
rule: "Host(`{{ cookiecutter.domain_name }}`)"
|
|
||||||
{%- endif %}
|
|
||||||
entryPoints:
|
|
||||||
- web
|
|
||||||
middlewares:
|
|
||||||
- redirect
|
|
||||||
- csrf
|
|
||||||
service: django
|
|
||||||
|
|
||||||
web-secure-router:
|
web-secure-router:
|
||||||
{%- if cookiecutter.domain_name.count('.') == 1 %}
|
{%- if cookiecutter.domain_name.count('.') == 1 %}
|
||||||
rule: "Host(`{{ cookiecutter.domain_name }}`) || Host(`www.{{ cookiecutter.domain_name }}`)"
|
rule: "Host(`{{ cookiecutter.domain_name }}`) || Host(`www.{{ cookiecutter.domain_name }}`)"
|
||||||
|
@ -67,11 +59,6 @@ http:
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
middlewares:
|
middlewares:
|
||||||
redirect:
|
|
||||||
# https://docs.traefik.io/master/middlewares/redirectscheme/
|
|
||||||
redirectScheme:
|
|
||||||
scheme: https
|
|
||||||
permanent: true
|
|
||||||
csrf:
|
csrf:
|
||||||
# https://docs.traefik.io/master/middlewares/headers/#hostsproxyheaders
|
# https://docs.traefik.io/master/middlewares/headers/#hostsproxyheaders
|
||||||
# https://docs.djangoproject.com/en/dev/ref/csrf/#ajax
|
# https://docs.djangoproject.com/en/dev/ref/csrf/#ajax
|
||||||
|
|
Loading…
Reference in New Issue
Block a user