Using custom domain for a django page through traefik

i have my first custom domain (its through godaddy)

ive hooked it up to cloudflare.

i want to connect to it with traefik.

i have a django webpage that works fine on port 8000, so i switched it over to 80 (because thats what i think i need to for traefik to see it) and no dice. trying to connect to my custom domain just hangs and the port gives me a 404 error.

traefik dashboard looks fine and so do my records on cloudflare (as far as i can tell ive never done this)

i was hoping someone could help me connect to my django page through my custom domain. is there anything ive done in the evidence provided below that looks wrong? is there anything else you would need to see?

my docker-compose.yml is below

version: "3.3"

services:

  traefik:
    image: "traefik:v2.9"
    container_name: "traefik"
    command:
      #- "--log.level=DEBUG"
      - "--api.insecure=true"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
    ports:
      - "80:80"
      - "8080:8080"
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:ro"


  frontend:
    build: frontend
    image: frontend
    container_name: frontend
#    ports:
#        - 8000:8000
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.whoami.rule=Host(`tgmjack.com`)"
      - "traefik.http.routers.whoami.entrypoints=web"

below is a collection of screenshots demonstrating each thing.

enter image description here

do you have any advice or questions?

some tutorials ive seen used an API key, do i need an API key?

Some considerations:

  1. GoDaddy's pointing is ignored if you are using Cloudflare for your DNS, so we only look at Cloudflare's.
  2. On CloudFlare you need to remove that random ip you found set as the A record.
  3. You don't need to change your container port from 8000 to 80, you'll have to manage with an "ingress" or otherwise a webserver (nginx for example) a proxypass to localhost:8000.
  4. Traefik,p probabbly, already has an "ingress" used to provisoning the certificate, which is why it returns you an error on ".well-known/acme-challenge". This file is used to identify the actual ownership of a domain and this is needed to generate a valid SSL/TLS certificate. To do this you need to make sure that when you call your server at localhost:8000/.well-know/acme-challenge it returns the file with the unique key. You certainly find this information on Traefik (https://doc.traefik.io/traefik/https/acme/) this a link to the tutorial.

I recommend you to start checking the correct configuration of CloudFlare targeting by removing anything that is not useful to you.

I hope I have been of some help to you!

Back to Top