feat: media routing
This commit is contained in:
parent
eef3696e5e
commit
7787eb328f
2 changed files with 11 additions and 1 deletions
|
|
@ -28,6 +28,16 @@ server {
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_cache_bypass $http_upgrade;
|
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 404 /404.html;
|
||||||
|
|
||||||
error_page 500 502 503 504 /50x.html;
|
error_page 500 502 503 504 /50x.html;
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@ async def download_by_url(payload: DownloadByUrlRequest):
|
||||||
return {"path": rel}
|
return {"path": rel}
|
||||||
|
|
||||||
|
|
||||||
@app.get("/media/{path:path}")
|
@app.get("/{path:path}")
|
||||||
async def get_image(path: str):
|
async def get_image(path: str):
|
||||||
"""
|
"""
|
||||||
Отдаёт файл по относительному пути (например, posters/ab/cd/hash.jpg).
|
Отдаёт файл по относительному пути (например, posters/ab/cd/hash.jpg).
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue