fix(tubearchivist): fix nginx auth_request for cache/media files

The auth_request subrequest to /api/ping/ through the generic /api
location block doesn't properly forward cookies to the Django backend,
causing 403 for all /cache/ and /media/ requests.

Use a dedicated internal /_auth location that explicitly proxies to
/api/ping/ with Cookie header forwarding.
This commit is contained in:
CanbiZ (MickLesk)
2026-03-30 13:32:36 +02:00
parent 24e5d373c5
commit 8fc2dc2427

View File

@@ -115,23 +115,33 @@ cat <<'EOF' >/etc/nginx/sites-available/default
server {
listen 8000;
location = /_auth {
internal;
proxy_pass http://localhost:8080/api/ping/;
proxy_pass_request_body off;
proxy_set_header Content-Length "";
proxy_set_header Host $http_host;
proxy_set_header Cookie $http_cookie;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /cache/videos/ {
auth_request /api/ping/;
auth_request /_auth;
alias /opt/tubearchivist/cache/videos/;
}
location /cache/channels/ {
auth_request /api/ping/;
auth_request /_auth;
alias /opt/tubearchivist/cache/channels/;
}
location /cache/playlists/ {
auth_request /api/ping/;
auth_request /_auth;
alias /opt/tubearchivist/cache/playlists/;
}
location /media/ {
auth_request /api/ping/;
auth_request /_auth;
alias /opt/tubearchivist/media/;
types {
text/vtt vtt;
@@ -139,7 +149,7 @@ server {
}
location /youtube/ {
auth_request /api/ping/;
auth_request /_auth;
alias /opt/tubearchivist/media/;
types {
video/mp4 mp4;