Update nginx config and add Caddy2 support

- Fixed nginx.conf to proxy all API routes (/patches, /generate, /health, /docs)
- Changed frontend port to 3080 in docker-compose.yml
- Added Caddyfile for Caddy2 reverse proxy configuration
- Supports both FQDN and IP:port configurations
This commit is contained in:
Claude
2026-01-24 14:20:41 +00:00
parent 61af857800
commit 122b4ce326
3 changed files with 86 additions and 2 deletions
+54
View File
@@ -0,0 +1,54 @@
# Caddy 2 Configuration for AI Photo Edit
# Replace with your actual domain
ai-photo-edit.yourdomain.com {
# Frontend - serves the React app
reverse_proxy localhost:3080
# API routes - proxy to backend
handle /projects* {
reverse_proxy localhost:8000
}
handle /edits* {
reverse_proxy localhost:8000
}
handle /patches* {
reverse_proxy localhost:8000
}
handle /generate* {
reverse_proxy localhost:8000
}
handle /health {
reverse_proxy localhost:8000
}
handle /docs {
reverse_proxy localhost:8000
}
handle /openapi.json {
reverse_proxy localhost:8000
}
}
# Alternative: Use IP:Port format (no domain)
# :8080 {
# reverse_proxy localhost:3080
#
# handle /projects* {
# reverse_proxy localhost:8000
# }
# handle /edits* {
# reverse_proxy localhost:8000
# }
# handle /patches* {
# reverse_proxy localhost:8000
# }
# handle /generate* {
# reverse_proxy localhost:8000
# }
# }
+1 -1
View File
@@ -28,7 +28,7 @@ services:
dockerfile: Dockerfile
container_name: ai-photo-edit-frontend
ports:
- "80:80"
- "3080:80" # Frontend on port 3080
depends_on:
- backend
restart: unless-stopped
+31 -1
View File
@@ -16,7 +16,7 @@ server {
try_files $uri $uri/ /index.html;
}
# API proxy
# API proxy - proxy all API routes to backend
location /projects {
proxy_pass http://backend:8000;
proxy_http_version 1.1;
@@ -35,6 +35,36 @@ server {
proxy_cache_bypass $http_upgrade;
}
location /patches {
proxy_pass http://backend:8000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
location /generate {
proxy_pass http://backend:8000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
location /health {
proxy_pass http://backend:8000;
}
location /docs {
proxy_pass http://backend:8000;
}
location /openapi.json {
proxy_pass http://backend:8000;
}
# Cache static assets
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
expires 1y;