diff --git a/modules/frontend/nginx-default.conf b/modules/frontend/nginx-default.conf index c3a851f..6075999 100644 --- a/modules/frontend/nginx-default.conf +++ b/modules/frontend/nginx-default.conf @@ -28,6 +28,16 @@ server { proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } + + location /media/ { + rewrite ^/media/(.*)$ /$1 break; + proxy_pass http://nyanimedb-images: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; + } #error_page 404 /404.html; error_page 500 502 503 504 /50x.html; diff --git a/modules/image_storage/app/main.py b/modules/image_storage/app/main.py index ff59d36..2c915c3 100644 --- a/modules/image_storage/app/main.py +++ b/modules/image_storage/app/main.py @@ -99,7 +99,7 @@ async def download_by_url(payload: DownloadByUrlRequest): return {"path": rel} -@app.get("/media/{path:path}") +@app.get("/{path:path}") async def get_image(path: str): """ Отдаёт файл по относительному пути (например, posters/ab/cd/hash.jpg).