1.8 KiB
1.8 KiB
Production 404 Fix Instructions
Problem Identified
The 404 error on production was caused by incomplete Traefik routing configuration:
- No HTTP to HTTPS redirect was configured
- TLS challenge was used instead of HTTP challenge for Let's Encrypt
- Missing HTTP router configuration
Solution Applied
Fixed docker-compose.yml with:
1. Added HTTP to HTTPS redirect
# HTTP router - redirects to HTTPS
- "traefik.http.routers.quixotic-http.rule=Host(`${DOMAIN:-localhost}`)"
- "traefik.http.routers.quixotic-http.entrypoints=web"
- "traefik.http.routers.quixotic-http.middlewares=https-redirect"
# HTTPS redirect middleware
- "traefik.http.middlewares.https-redirect.redirectscheme.scheme=https"
- "traefik.http.middlewares.https-redirect.redirectscheme.permanent=true"
2. Changed to HTTP challenge for Let's Encrypt
- --certificatesresolvers.letsencrypt.acme.httpchallenge=true
- --certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=web
Deployment Steps
- Pull latest changes on production server
- Stop containers:
docker-compose down - Rebuild and start:
docker-compose --env-file .env.docker up -d --build - Check logs:
docker-compose logs -f quixotic-app traefik - Verify SSL certificate generation in Traefik logs
Verification
- HTTP requests should redirect to HTTPS
- HTTPS should work with valid SSL certificate
- Both
http://domain.comandhttps://domain.comshould work - Check Traefik dashboard at
http://server:8080for routing status
Files Changed
docker-compose.yml- Fixed Traefik labels and certificate resolver
Root Cause
Previous configuration only handled HTTPS traffic but didn't provide HTTP redirect or proper certificate challenge, causing 404 for users accessing via HTTP or when SSL certificates failed to generate.