kd2org / karadav

Lightweight NextCloud compatible WebDAV server
https://fossil.kd2.org/karadav/
GNU Affero General Public License v3.0
154 stars 14 forks source link

Files larger than 10mb fail to upload with Nextcloud app (403 error) #60

Open poVoq opened 4 months ago

poVoq commented 4 months ago

I have Karadav and php set up to accept files up to 50mb and uploading larger files works fine with the karadav web interface.

However via the desktop Nextcloud app only files smaller than 10mb are being synchronized for some strange reason. Any larger files are seemingly uploaded and then discarded with a 403 forbidden MKCOL error in visible in the Nextcloud app.

Any idea what might be the cause of that?

Edit: I solved the issue with other apps, but the Nextcloud app still reports a 403 error, which is odd, as this is not the 413 error that Nginx or php would give.

Edit: It seems to be somehow related to file permissions? Maybe the Nextcloud client somehow splits uploads larger than 10mb and KaraDAV gets confused with the file permissions on those?

poVoq commented 4 months ago

Seems related: https://help.nextcloud.com/t/error-with-chunked-file-uploads-through-windows-client/123270

So I guess the Nextcloud client uses a temp folder for larger files and then fails to move the file those files due to some permission issue?

bohwaz commented 4 months ago

Do you have anything in the error.log?

poVoq commented 4 months ago

Nothing at all in the error.log file, but maybe there is something going wrong there also? Would a failed login attempt be logged there?

bohwaz commented 4 months ago

If it's empty, try to enable the HTTP debug log and see what's going on during the upload when the 403 error happens.

poVoq commented 4 months ago

The debug log gives this:

===== ROUTER: Got new request: 17/07/2024 20:26:49 from 192.168.1.1 =====

ROUTER: <= MKCOL /remote.php/dav/uploads/5386c1e7bd9c410d07ffcc88fc2ceb29deafe180/1183742603 (User: povoq)
Request headers:
  Accept-Language: de-DE,en,*
  Accept-Encoding: gzip, deflate
  Cookie: PHPSESSID=*censored*
  X-Request-Id: f31d7789-18ba-4500-84d4-2217a44214d0
  Accept: */*
  User-Agent: Mozilla/5.0 (Linux) mirall/3.13.0git (Nextcloud, fedora-6.9.9-200.fc40.x86_64 ClientArchitecture: x86_64 OsArchitecture: x86_64)
  Authorization: Basic *censored*
  Oc-Total-Length: 16225576
  Destination: https://webdav.example.org/remote.php/dav/files/5386c1e7bd9c410d07ffcc88fc2ceb29deafe180/example/15mbexamplefile.pdf
  Content-Length: 0
  Connection: close
  X-Forwarded-For: xxx.xxx.xxx.xxx
  Host: webdav.example.org
  Content-Type:

ROUTER: <= Request body:

DAV: NC <= MKCOL remote.php/dav/uploads/5386c1e7bd9c410d07ffcc88fc2ceb29deafe180/1183742603 => routed to: chunked

DAV: NC => 403 - Invalid username in URL, does not match logged user

ROUTER: => 403
Response headers:
  X-Powered-By: PHP/8.3.9
  Expires: Thu, 19 Nov 1981 08:52:00 GMT
  Cache-Control: no-store, no-cache, must-revalidate
  Pragma: no-cache
poVoq commented 3 months ago

Anything else I could do to narrow it down?

KK612 commented 2 months ago

same issue here

nproth commented 2 weeks ago

I had the same issue and I think I fixed it in PR #61.