I keep getting 404 errors when trying configure my custom domain with traefik

Hi,

I've used django-cookiecutter to set up my Django project, which also bootstraps traefik configuration for me. I'm deploying this project in AWS, and facing some issues. Here's how my configuration file looks like,

log:
  level: DEBUG

entryPoints:
  web:
    address: ":80"

  web-secure:
    address: ":443"

certificatesResolvers:
  letsencrypt:
    acme:
      email: "someemail@gmail.com"
      storage: /etc/traefik/acme/acme.json
      httpChallenge:
        entryPoint: web

http:
  routers:
    web-router:
      rule: "Host(`cheerdocs.com`)"
      entryPoints:
        - web
      middlewares:
        - redirect
        - csrf
      service: django

    web-secure-router:
      rule: "Host(`cheerdocs.com`)"
      entryPoints:
        - web-secure
      middlewares:
        - csrf
      service: django
      tls:
        certResolver: letsencrypt

  middlewares:
    redirect:
      redirectScheme:
        scheme: https
        permanent: true
    csrf:
      headers:
        hostsProxyHeaders: ["X-CSRFToken"]

  services:
    django:
      loadBalancer:
        servers:
          - url: http://django:5000

providers:
  file:
    filename: /etc/traefik/traefik.yml
    watch: true

If I replace the domain (i.e. cheerdocs.com) in,

  • rule: "Host(cheerdocs.com) with my Elastic IP or AWS public domain, I'm able to access my django site using the Elastic IP or AWS public domain respectively, but get 404 with cheerdocs.com.

And even when I add the hosts to cheerdocs.com, I'm getting the same 404 errors, even the IP and aws domain give 404 after making this change.

Can someone please guide me how can I achieve this? Sorry if it's a silly question, I haven't used a web-proxy before and still trying to learn.

If it helps, here's how my DNS settings look like

Any help will be highly appreciated. Please let me know if I've missed any important detail.

Fixed my error.

It was a cloudflare issue instead of being a configuration issue.

I had to set SSL protection to "Full" in Cloudflare to get it working. Hope it helps someone in future facing similar issue.