404
This commit is contained in:
47
.serena/memories/production_404_fix_instructions.md
Normal file
47
.serena/memories/production_404_fix_instructions.md
Normal file
@@ -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.
|
||||||
Reference in New Issue
Block a user