log:
  level: INFO

entryPoints:
  web:
    # http
    address: ":80"

http:
  routers:
    web-router:
      rule: 'Host(`ref2021.tvof.ac.uk`) || Host(`ref2021.tvof3.kdl.kcl.ac.uk`)'
      entryPoints:
        - web
      middlewares:
        - csrf
      service: django

    web-media-router:
      rule: 'Host(`ref2021.tvof.ac.uk`) || Host(`ref2021.tvof3.kdl.kcl.ac.uk`) && PathPrefix(`/media/`)'
      entryPoints:
        - web
      middlewares:
        - csrf
      service: django-media

  middlewares:
    csrf:
      # https://docs.traefik.io/master/middlewares/headers/#hostsproxyheaders
      # https://docs.djangoproject.com/en/dev/ref/csrf/#ajax
      headers:
        hostsProxyHeaders: ['X-CSRFToken']

  services:
    django:
      loadBalancer:
        servers:
          - url: http://django:5000
    django-media:
      loadBalancer:
        servers:
          - url: http://nginx:80

providers:
  # https://docs.traefik.io/master/providers/file/
  file:
    filename: /etc/traefik/traefik.yml
    watch: true

log:
  level: INFO

entryPoints:
  web:
    # http
    address: ":80"

http:
  routers:
    web-router:
      rule: 'Host(`ref2021.tvof.ac.uk`) || Host(`tvof3-ref.kdl.kcl.ac.uk`)'
      entryPoints:
        - web
      middlewares:
        - csrf
      service: django

    web-media-router:
      rule: 'Host(`ref2021.tvof.ac.uk`) || Host(`tvof3-ref.kdl.kcl.ac.uk`) && PathPrefix(`/media/`)'
      entryPoints:
        - web
      middlewares:
        - csrf
      service: django-media

  middlewares:
    csrf:
      # https://docs.traefik.io/master/middlewares/headers/#hostsproxyheaders
      # https://docs.djangoproject.com/en/dev/ref/csrf/#ajax
      headers:
        hostsProxyHeaders: ['X-CSRFToken']

  services:
    django:
      loadBalancer:
        servers:
          - url: http://django:5000
    django-media:
      loadBalancer:
        servers:
          - url: http://nginx:80

providers:
  # https://docs.traefik.io/master/providers/file/
  file:
    filename: /etc/traefik/traefik.yml
    watch: true

Support for tvof3-ref.kdl.kcl.ac.uk domain for testing.
Support for tvof3-ref.kdl.kcl.ac.uk domain for testing.
