From ef287dd2a7a8ebcc6878d1e05a0be271906d9e73 Mon Sep 17 00:00:00 2001 From: VC Date: Fri, 5 Jul 2024 11:53:46 +0200 Subject: [PATCH] feat: update peertube template --- .../templates/vhosts/p.nintendojo.fr.conf.j2 | 28 ++----------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/roles/nginx/templates/vhosts/p.nintendojo.fr.conf.j2 b/roles/nginx/templates/vhosts/p.nintendojo.fr.conf.j2 index 68588a2..6ff9ed8 100644 --- a/roles/nginx/templates/vhosts/p.nintendojo.fr.conf.j2 +++ b/roles/nginx/templates/vhosts/p.nintendojo.fr.conf.j2 @@ -27,7 +27,7 @@ server { try_files /dev/null @api; } - location = /api/v1/videos/upload-resumable { + location ~ ^/api/v1/videos/(upload-resumable|([^/]+/source/replace-resumable))$ { client_max_body_size 0; proxy_request_buffering off; @@ -141,29 +141,7 @@ server { alias /srv/peertube/peertube-latest/client/dist/$1; } - # Bypass PeerTube for performance reasons. Optional. - location ~ ^/static/(thumbnails|avatars)/ { - if ($request_method = 'OPTIONS') { - add_header Access-Control-Allow-Origin '*'; - add_header Access-Control-Allow-Methods 'GET, OPTIONS'; - add_header Access-Control-Allow-Headers 'Range,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type'; - add_header Access-Control-Max-Age 1728000; # Preflight request can be cached 20 days - add_header Content-Type 'text/plain charset=UTF-8'; - add_header Content-Length 0; - return 204; - } - - add_header Access-Control-Allow-Origin '*'; - add_header Access-Control-Allow-Methods 'GET, OPTIONS'; - add_header Access-Control-Allow-Headers 'Range,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type'; - add_header Cache-Control "public, max-age=7200"; # Cache response 2 hours - - rewrite ^/static/(.*)$ /$1 break; - - try_files $uri @api; - } - - location ~ ^(/static/(webseed|streaming-playlists)/private/)|^/download { + location ~ ^(/static/(webseed|web-videos|streaming-playlists)/private/)|^/download { # We can't rate limit a try_files directive, so we need to duplicate @api proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; @@ -176,7 +154,7 @@ server { } # Bypass PeerTube for performance reasons. Optional. - location ~ ^/static/(webseed|redundancy|streaming-playlists)/ { + location ~ ^/static/(webseed|web-videos|redundancy|streaming-playlists)/ { limit_rate_after 5M; # Clients usually have 4 simultaneous webseed connections, so the real limit is 3MB/s per client