From 4dacc1aeb8c3cee801970762a9d9ca05817d2463 Mon Sep 17 00:00:00 2001 From: Andrey Kondratev <81143241+cockroach-eater@users.noreply.github.com> Date: Fri, 29 Aug 2025 14:33:31 +0500 Subject: [PATCH] 404 --- .../production_404_fix_instructions.md | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .serena/memories/production_404_fix_instructions.md diff --git a/.serena/memories/production_404_fix_instructions.md b/.serena/memories/production_404_fix_instructions.md new file mode 100644 index 0000000..35d6dde --- /dev/null +++ b/.serena/memories/production_404_fix_instructions.md @@ -0,0 +1,47 @@ +# Production 404 Fix Instructions + +## Problem Identified +The 404 error on production was caused by incomplete Traefik routing configuration: +1. No HTTP to HTTPS redirect was configured +2. TLS challenge was used instead of HTTP challenge for Let's Encrypt +3. Missing HTTP router configuration + +## Solution Applied +Fixed `docker-compose.yml` with: + +### 1. Added HTTP to HTTPS redirect +```yaml +# 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 +```yaml +- --certificatesresolvers.letsencrypt.acme.httpchallenge=true +- --certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=web +``` + +## Deployment Steps +1. Pull latest changes on production server +2. Stop containers: `docker-compose down` +3. Rebuild and start: `docker-compose --env-file .env.docker up -d --build` +4. Check logs: `docker-compose logs -f quixotic-app traefik` +5. Verify SSL certificate generation in Traefik logs + +## Verification +- HTTP requests should redirect to HTTPS +- HTTPS should work with valid SSL certificate +- Both `http://domain.com` and `https://domain.com` should work +- Check Traefik dashboard at `http://server:8080` for 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. \ No newline at end of file