Fix nginx routing for development environment

- Fixed nginx proxy configuration for API endpoints
- Added proper proxy headers and max body size for uploads
- Added /api/groups endpoint routing
- Corrected proxy_pass paths to route properly to backend
- API endpoints now accessible via nginx proxy

Fixes: Image upload routing issue in development environment
This commit is contained in:
Matthias Lotz 2025-11-06 17:35:09 +01:00
parent ae67bc7978
commit 782f11e513

View File

@ -6,7 +6,7 @@ server {
# API proxy to development backend
# Upload endpoint
location /api/upload {
proxy_pass http://backend-dev:5000/upload;
proxy_pass http://backend-dev:5000/upload/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@ -15,6 +15,18 @@ server {
}
# Download original images
# Handle POST requests to upload endpoint
location /api/upload {
proxy_pass http://backend-dev:5000/upload;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Content-Type $content_type;
client_max_body_size 100M;
}
# Preview/thumbnail images (optimized for gallery views)
location /api/download {
proxy_pass http://backend-dev:5000/download;
proxy_set_header Host $host;
@ -23,7 +35,6 @@ server {
proxy_set_header X-Forwarded-Proto $scheme;
}
# Preview/thumbnail images (optimized for gallery views)
location /api/previews {
proxy_pass http://backend-dev:5000/previews;
proxy_set_header Host $host;
@ -32,6 +43,15 @@ server {
proxy_set_header X-Forwarded-Proto $scheme;
}
# Add groups endpoint
location /api/groups {
proxy_pass http://backend-dev:5000/groups;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# Groups API
location /api/groups {
proxy_pass http://backend-dev:5000/groups;