YunoHost-Apps / peertube_ynh

Federated (ActivityPub) video streaming platform using P2P for YunoHost
https://joinpeertube.org/fr/
GNU Affero General Public License v3.0
88 stars 28 forks source link

nginx config does not allow import #456

Open olelond opened 1 month ago

olelond commented 1 month ago

Describe the bug

When trying to import an archive from another peertube an error i shown "Your archive file was too large". From nginx log files I could see that the failing request was to PUT /api/v1/users/2/imports/import-resumable and that nginx was saying "client intended to send too large body" which apparently is due to client_max_body_size being to low. I noticed that in /etc/nginx/conf.d/[mydomain].d/peertube.conf that there is special settings for client_max_body_size but not one matching the url above. I was able to make import working by adding this:

location ~ ^/api/v1/users/2/imports/ {
  client_max_body_size                    24G; # default is 1M
  more_set_headers "X-File-Maximum-Size : 16G always"; # inform backend of the set value in bytes before mime-encoding (x * 1.4 >= client_max_body_size)
  try_files /dev/null @api;
}

Which is probably not the correct way to solve it. But it confirms that the error indeed comes from a wrong default nginx configuration in yunohost peertube.

Context

Steps to reproduce

Install peertube from webadmin. In peertube go to My account > Import/Export and select an archive to import. Immidiately the message "Your archive file was too large" is shown and the archive is not imported.

Expected behavior

The archive should be imported

Logs

from /var/log/nginx/[mydomain]-error.log 2024/10/11 13:38:48 [error] 488850#488850: *133967 client intended to send too large body: 16777216 bytes, client: 188.178.190.170, server: [mydomain], request: "PUT /api/v1/users/2/imports/import-resumable?upload_id=af63af4c8601a015-55af4152b0870c22-f8e203d480151d5a-d00ce411dfda444e HTTP/2.0", host: "[mydomain]", referrer: "https://[mydomain]/my-account/import-export"

JohnXLivingston commented 2 weeks ago

The nginx configuration changed with v6.1.0. See the changelog for the location to add.