Skip to content

[BUG] Handling of HTTP response code 413 #4094

Closed

Description

@yunal

Actual behaviour

Android App version dated 25. of May 2023, version 4.0.

I try to upload a image to the OC server. And get a "unknown error" message. I google. I set php upload limits. The error message persists.

I enable server side debug logging. No direct clues there. I enable client side logging. Aha!

D: 2023-07-10 21:43:16:842(FileRequestBody.kt:70) .writeTo()File with name IMG_20230710_213046.jpg and size 2385151 written in request body
D: 2023-07-10 21:43:16:842(LogBuilder.kt:38) .logHttp()[Network, response] [info] [3651f353-788b-4a52-8caa-30f0faf8a0d2] Method: PUT URL: https://oc.langfeldt.net/remote.php/dav/files/Nicolai/Photos/IMG_202307\
10_213046.jpg Code: 413 Message: Request Entity Too Large
D: 2023-07-10 21:43:16:843(LogBuilder.kt:38) .logHttp()[Network, response] [header] [3651f353-788b-4a52-8caa-30f0faf8a0d2] Server: nginx/1.18.0 (Ubuntu)
D: 2023-07-10 21:43:16:844(LogBuilder.kt:38) .logHttp()[Network, response] [header] [3651f353-788b-4a52-8caa-30f0faf8a0d2] Date: Mon, 10 Jul 2023 19:42:48 GMT
D: 2023-07-10 21:43:16:844(LogBuilder.kt:38) .logHttp()[Network, response] [header] [3651f353-788b-4a52-8caa-30f0faf8a0d2] Content-Type: text/html
D: 2023-07-10 21:43:16:845(LogBuilder.kt:38) .logHttp()[Network, response] [header] [3651f353-788b-4a52-8caa-30f0faf8a0d2] Content-Length: 192
D: 2023-07-10 21:43:16:845(LogBuilder.kt:38) .logHttp()[Network, response] [header] [3651f353-788b-4a52-8caa-30f0faf8a0d2] Connection: close
D: 2023-07-10 21:43:16:846(LogBuilder.kt:38) .logHttp()[Network, response] [body] [3651f353-788b-4a52-8caa-30f0faf8a0d2] Length: 192 byte body
D: 2023-07-10 21:43:16:848(LogBuilder.kt:38) .logHttp()[Network, response] [body] [3651f353-788b-4a52-8caa-30f0faf8a0d2] Type: text/html
D: 2023-07-10 21:43:16:849(LogBuilder.kt:38) .logHttp()[Network, response] [body] [3651f353-788b-4a52-8caa-30f0faf8a0d2] --> Body start for response
D: 2023-07-10 21:43:16:850(LogBuilder.kt:38) .logHttp()[Network, response] [body] [3651f353-788b-4a52-8caa-30f0faf8a0d2] <html>^M
<head><title>413 Request Entity Too Large</title></head>^M
<body>^M
<center><h1>413 Request Entity Too Large</h1></center>^M
<hr><center>nginx/1.18.0 (Ubuntu)</center>^M
</body>^M
</html>^M

D: 2023-07-10 21:43:16:850(LogBuilder.kt:38) .logHttp()[Network, response] [body] [3651f353-788b-4a52-8caa-30f0faf8a0d2] <-- Body end for response -- Omitted: 0 bytes
D: 2023-07-10 21:43:16:852(RemoteOperationResult.java:320) .<init>()RemoteOperationResult has processed UNHANDLED_HTTP_CODE: 413 Request Entity Too Large
I: 2023-07-10 21:43:16:853(UploadFileFromFileSystemOperation.kt:79) .run()Upload of /storage/emulated/0/Android/data/com.owncloud.android/cache/IMG_20230710_213046.jpg to /Photos/IMG_20230710_213046.jpg: Opera\
tion finished with HTTP status code 413 (fail)

The unknown error is a Unhandled HTTP Code 413. From the server signature I'm forced to realize that we use a nginx reverse proxy as ingress controller and this proxy has not gotten the upload size enlarged. A client_max_body_size 16G; is needed.

Expected behaviour

A better error message based on the 413 response code. If it includes the server signature this might help the operator to trace the problem better.

Steps to reproduce

  1. Install OC, enlarge all upload limits
  2. Install nginx as a reverse proxy ingress controller in front of OC, with default upload limits
  3. Witness 413 error code.

Can this problem be reproduced with the official owncloud server?
(url: https://demo.owncloud.org, user: test, password: test)

Environment data

Android version: 12
Device model: Fairphone 4
Stock or customized system: Stock
ownCloud app version: 4.0
ownCloud server version: 10.12.2

Logs

Web server error log

Nothing interesing here as problem request never reached apache

ownCloud log (data/owncloud.log)

Nothing interesting here as requrest never even reached the apache in front

Activity

  1. michaelstingl commented on Jul 11, 2023

    @michaelstingl
    Contributor

    Thanks for your feedback.

    Could you post a screenshot of the current error you see?

    What do you mean with “server signature” in an improved error message? Do you have examples from other apps?

  2. yunal commented on Jul 12, 2023

    @yunal
    Author

    Hi,

    This is the server signature (from the HTTP response headers): Server: nginx/1.18.0 (Ubuntu) - this will help a ops person figure out what system gave the error message more easily. Most companies and many private installations will have a border-reverse proxy such as nginx, haproxy, varnish, something from BigIP etc, which relays http requests to the right origin server, e.g. the owncloud server. Any of these might enforce a size restriction.

  3. jesmrec commented on Jul 13, 2023

    @jesmrec
    Member

    @yunal i get your point, in any case we should handle errors from the app, no matter which middleware are installed between client and server. We'll review.

  4. modified the milestones: 4.7 - Next, Backlog on Jun 6, 2025
  5. self-assigned this
    on Sep 24, 2025
  6. linked a pull request that will close this issue[FIX] Handling of HTTP response code 413 #4685on Sep 24, 2025
  7. jesmrec commented on Oct 3, 2025

    @jesmrec
    Member

    @yunal, a fix for the issue will be available in the next release. If you'd like to take a look in advance, we could provide you a test artifact to be installed in your device.

  8. yunal commented on Oct 5, 2025

    @yunal
    Author

    Thanks so much. I'll just await the regular update thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions