Ios: 413 error when uploading file from iOS client

Created on 18 Oct 2017  Â·  104Comments  Â·  Source: nextcloud/ios

Since upgrading to iOS 11 (11.0.2), I have found that the iOS NextCloud client is unable to upload "large" files - in my example, an 11 MB PDF file is failing to upload, with error "413" reported. I have no problem uploading the same file via the desktop client (Mac).

I am not seeing any corresponding entries in the server side log (via the NextCloud web-admin console).

I have experienced this problem on both iPhone 6 plus and iPad Pro (big one, first version). Both are at iOS 11.0.2 and have the latest NextCloud app.

I am initiating the upload using the "share sheet" in Safari with the PDF loaded in the browser. See screen shots.

img_1913
img_1914
img_1915

0. Needs triage

Most helpful comment

After 2 days of trying to fix this iOS 413 error I found out that CloudFlare is the issue here. Their free tier do not support big chunks of files

All 104 comments

Hi ! why you use "Copy to Nextcloud" and not the extension provider "Nextcloud" ? ...

anyway I don't have issue of Upload file ... (10 MB is a small file).

Uh - what do you mean "extension provider"? In any case, this workflow should still work - should it not?

U can try : Go to Settings->Advanced->Exit (this remove all file, keys, DB etc.) , remove Nextcloud and reinstall from Appstore or TestFlight.

@ntompson any new ?

Similar issue here, I can upload a file pressing [+->Upload a file] if I used [+->Upload photos or Videos] I get 413, I checked the logs and the 413 comes from

172.20.0.2 -  [08/Dec/2017:03:11:49 +0000] "PROPFIND /remote.php/webdav/test-2530.jpg HTTP/1.1" 404 210 "-" "Mozilla/5.0 (iOS) Nextcloud-iOS/2.18.2" "91.55.82.227"

looks like the HTTP PUT is missing so it was not uploaded,

I can see a PUT while using [+->Upload a file] after it does a PROPFIND that returns 207.
BTW: my failed upload filename is test-2341.jpg

Verify (e.g.) :

in /etc/php//apache2/php.ini

; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
upload_max_filesize = 1000M

Just wanted to chime in and say I am also getting this issue. I did a little testing and it seems via either auto-upload or just straight upload through the iOS app it won't upload videos that are larger then 100MB. I get a 431 error and it just trys again.

Apologies for the lengthy hiatus. This is still occurring for me. Upload max file size is significantly larger (10 GB from memory) than the files that trip the NextCloud app up. the iPad app often trips up in this way on a multi-MB PDF (smaller than 10, usually) with the 431 error. Not only that, the iPad app then shows a notification badge, which won't go away. Every time I open the iPad app, the app repeats the 431 error message.

I had the same issue after setting up NextCloud through letsencrypt (nginx) reverse proxy on my unraid server.

Although everything seemed to be in order, my nextcloud site referenced a 'proxy.conf' file that I needed to edit (/appdata/letsencrypt/nginx/proxy.conf) -- changing the _client_max_body_size 10m;_ to _client_max_body_size 0;_ removed the 10MB limit on uploading files.

Still not resolved for me. Interesting to note that with the new support for the iOS files app, large-ish uploads also fail, although silently from the files app.

I am also using nextcloud behind nginx reverse proxy, but already have client_max_body_size 0. Here is the rest of my proxy config in case anything jumps out:

`server {
listen 443 ssl;
server_name \<\;

root /config/www;
index index.html index.htm index.php;

###SSL Certificates
ssl_certificate /config/keys/letsencrypt/fullchain.pem;
ssl_certificate_key /config/keys/letsencrypt/privkey.pem;

###Diffie–Hellman key exchange ###
ssl_dhparam /config/nginx/dhparams.pem;

###SSL Ciphers
ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';

###Extra Settings###
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;

    ### Add HTTP Strict Transport Security ###
add_header Front-End-Https on;

client_max_body_size 0;

location / {
    proxy_pass https://<<mylocaldomain>>:444/;
    proxy_max_temp_file_size 2048m;
    include /config/nginx/proxy.conf;
}

}`

(apologies - I don’t seem capable of getting the markdown to behave...)

Same error for me. Same file uploads without problem either on the web interface or using the linux desktop client, however on IOS, if the file is larger than 100mb the file starts to upload, it completes all the progress bar and just after reaching 100% it shows a message of 413.

Does anybody have any clue of what could be the problem? it is only happening to me on iOS clients, not on desktop syncs.

Yes exactly @netpanda - all platforms desktop sync works fine (any sized upload), but iOS uploads of very small sizes break. No update from me.

Same issue when I'm trying to upload the small pics to Nextcloud (which is running with docker-compose: with-nginx-proxy-self-signed-ssl).

The MAX_UPLOAD_SIZE=10GB in proxy layer is ignored by the image.

So I have to specific the configuration for the virtual_host,

echo 'client_max_body_size 10G;' > /path/to/vhost.d/app.example.com

My iPad is happy now. 😄

@linxux, I am running the Nextcloud pic install. I’ll look into this, thanks.

hello i am getting error 413 on my ios device when i try to upload files bigger than 10MB and that is when i connect through my reverse proxy
but nothing when i connect to my internal ip can any one help me

@trillingsgaard if you are using nginx change to client_max_body_size 0.

This thread is for a different problem that nobody seems to be able to solve. the fact that nextcloud allows to upload big files (more than 1GB) from every client (web, desktop, android) except from IOs client.

Nextcloud for iOS 2.22.4.0 on Nextcloud Server Version 14.0.3
Files upload to server through web browser but get error code 413 using iOS Nextcloud App.

Seems to be reported on the Nextcloud Forum here as well.

https://help.nextcloud.com/t/file-upload-problem-with-the-new-ios-app-v2-22-1-0/35474

My situation was in fact an error on my part, it was my nginx config and having the client_max_body_size set to low. Oddly however I had no problems downloading and uploading files through the browser with those low settings just with the app.

I know this is quite an old thread, but I think I've hit the same issue. Running Nextcloud 15.0.0 in a FreeBSD jail and connecting externally through an NGINX reverse-proxy.

I thought I'd back up the photos and videos on an iPad my daughter had been using and thought the Auto upload in Nextcloud was as good a way as any. There were less than 200 files all in, with a few of the video files around 250MB and one at 1.3GB. All of the files, except the 1.3GB file uploaded without a problem, but try as I might the 1.3GB file would not. I've checked PHP settings and it should allow uploads of up to 10GB.

I ended up using iExplorer and copying the .mov file onto my iMac and then from their uploading to Nextcloud using the WUI via Chrome. No issues at all uploading the file this way.

@crazybadger so you have client_max_body_size 0; set in your nginx
server block?

I'm pretty sure I stopped having issues on IOS after doing this.

On Mon, 31 Dec 2018 at 7:49 AM, crazybadger notifications@github.com
wrote:

I know this is quite an old thread, but I think I've hit the same issue.
Running Nextcloud 15.0.0 in a FreeBSD jail and connecting externally
through an NGINX reverse-proxy.

I thought I'd back up the photos and videos on an iPad my daughter had
been using and thought the Auto upload in Nextcloud was as good a way as
any. There were less than 200 files all in, with a few of the video files
around 250MB and one at 1.3GB. All of the files, except the 1.3GB file
uploaded without a problem, but try as I might the 1.3GB file would not.
I've checked PHP settings and it should allow uploads of up to 10GB.

I ended up using iExplorer and copying the .mov file onto my iMac and then
from their uploading to Nextcloud using the WUI via Chrome. No issues at
all uploading the file this way.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/nextcloud/ios/issues/396#issuecomment-450579516, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AEerXWdSFX9zWZJzpAdyR7DAKU0PofdXks5u-QqxgaJpZM4P88qg
.

Yes, I already have that in my NGINX server block.

On 30 Dec 2018, at 23:35, mattie47 notifications@github.com wrote:

client_max_body_size 0

yeap.. I could never fixed this.. I need to sync large videos with Itunes and then upload them through a web browser on my PC, the iOS client was never able to upload large files from my iphone.

I just run into this issues when I tried to upload a >500MB video via the iOS 12.1.3 client. PHP and Ngnix are configured for 10GB uploads. It looks like the problem still persists.

I’m experiencing the same issue. From android Or desktop it os fine,iOS fails

Same issue. Tested on:
iPhone 5 iOS v10.0.2
iPhone 7 iOS v12.1
In both cases, images uploaded without any issues, but a video with approx 30mb fails.
On the same server installation uploads from desktop or Android (Sams s9) works ok.

Can confirm this issue, iPhone XS iOS v12.1.2

I have had the same problem with the iOS App. I couldn't upload images only small text files. The PHP values where all OK. Upload form webbrowser was fine.
Apache error log has said this:

request body exceeds maximum size (131072) for SSL buffer
could not buffer message body to allow SSL renegotiation to proceed

So I have added this line to my apache directory conf:

SSLRenegBufferSize 100000000

And now the iOS App is working fine.

I am not shure, if this is still an error of the app, because webbrowsers don't need an ssl buffer as big as the file to upload. maybe they send the files in small pieces and the ios app does not?

I’m also having the same issue that many others have stated here. I can upload a 1+gb file over web with a pc, but cannot upload over the iOS app. Running nginx webserver setup. Client max body size is confirmed set to 0. I’ve also tried setting it to 10gb. Still won’t work.

I have had the same problem with the iOS App. I couldn't upload images only small text files. The PHP values where all OK. Upload form webbrowser was fine.
Apache error log has said this:

request body exceeds maximum size (131072) for SSL buffer
could not buffer message body to allow SSL renegotiation to proceed

So I have added this line to my apache directory conf:

SSLRenegBufferSize 100000000

And now the iOS App is working fine.

I am not shure, if this is still an error of the app, because webbrowsers don't need an ssl buffer as big as the file to upload. maybe they send the files in small pieces and the ios app does not?

My apache is not handling SSL, the SSL connection ends on my NGINX. I still have the same problem with Nextcloud 15.. Every client except the IOS one, are able to upload files bigger than 100, IOS fails.

I have just checked it too, Nexcloud 15 does not solve the problem.

Out of interest is anyone running their Nextcloud instance behind Cloudflare caching? I am trying my NC instance without Cloudflare because I found that it was breaking my iOS upload. It seems Cloudflare has a limit of 100MB per file on the free tier. Maybe the web and desktop versions didn't run into these issues because they were breaking the files into smaller chunks and the iOS version isn't?

@Dimtar I personally do not use Cloudflare

Same issue here as well. Works fine with browser, but not iOS.

Same issue here as well. Works fine with browser, but not iOS.

For me the Same.
Tried also the TestFlight Version. Last Version from Nextcloud Version: 15.0.5.3
Provider: all-inkl.com

Hi all,

Can I suggest you make a review/comment on the iOS app store about this? I can't seem to see another way of getting nextcloud to fix this or acknowledge the problem...

@mattie47
Done already some minutes ago. Make a comment with 1star only the we get heard

Hi all, who can create an account test for me ? but before if this problem is the limit of mb of upload file please this is not an issue of Nextcloud iOS, and please close this.

Hi all,

Can I suggest you make a review/comment on the iOS app store about this? I can't seem to see another way of getting nextcloud to fix this or acknowledge the problem...

We have over 800.000 users ... maybe the problem is not the iOS ... have you thought about it ?

Marino, there is definitely a difference on how the iOS clients uploads files and how the browser does.. This thread is from 2017, with multiple reports of the same issue, and nobody seems to provide any insight about what can be the cause. I personally tried the Android App, and it has no issue at all either, so who do you think that we should direct our questions if it is not to the iOS app?

@netpanda but your issue is : no upload any files or not upload files with size > x MB ?

@marinofaggiana In my case (and I think in the other cases, too) small files are OK bigger ones failed. I had to tweek the ssl buffer of my nextcloud server. The buffer has to be bigger than the size of the uploaded file. (witch is not standard as far as I know) So i think this problem only occurs with encrypted file uploads.

@marinofaggiana In my case:
PC with Firefox, chrome, edge = All files ( Larger than 100 mb)
Desktop Client (Windows, Linux, Mac) = All files (Larger than 100 mb)
Android App = All files (Larger than 100 mb)
iOS App = Only files smaller than 100 mb

Nextcloud configuration:

Nextcloud 15 served by apache2 with Nginx Proxy in front.

The question: Why it works on every environment except in iOS? what iOS is doing differently on the uploads? Im sure that is something that we can fix with some tweaking on Nginx or Apache, but without knowing what is doing differently, I cannot play with that config.

Thanks.

I can confirm exactly as above, I thought I had it fixed a long time ago, but I had not. Everything but the iOS app loads larger files without a problem. I have changed the Nginx settings and the upload file size in Nextcloud but still does not work.

Marino,

This issue is definitely with the iOS version of the app. It seems to be pretty easily repeatable. Many, inlcuding myself have laid out all the changes we have made. I personally am using all of the settings and suggested configuration from linuxserver.io. I’m running this in a docker container. I think nextcloud doesn’t care about iOS and this issue as most people are either using this just for downloading or on Android/pc. I as well have given the app a 1 star on the App Store. I’m about ready to scrap the whole setup and move to something else.

@netpanda create an account for me, I can try with a file > 100 MB.

send: to ios at nextcloud dot com

I tried having a look at this yesterday to see if I could reproduce the problem (I normally don't have videos or large files uploading from my iPhone), but I didn't have much luck.

I tried uploading from my phone some 400MB videos but had no issues doing so in the app.
I then tried doing the exact same steps as @ntompson's first post in safari with a 22MB PDF but still no problem.

This is with iPhone 7 IOS 11.3.1.

I was originally following this ticket from when I hadn't done the nginx document size changes, meanwhile a few months later I had some 413 errors uploading any files to nextcloud. However, I can no longer reproduce the errors on this ticket.

@netpanda and others above, perhaps create a debug account for @marinofaggiana above to troubleshoot directly..

@marinofaggiana I have sent you an email with test account information.

Thanks,
Ryan

I'm having this same problem when trying to upload files to my server via a LetsEncrypt/NGINX reverse proxy, however it is happening with the camera auto-upload function (as some people have previously mentioned). My client_max_body_size is already set to 0 in both the nextcloud server block and my proxy.conf. Could it be possible that the proxy_max_temp_file_size setting in the nextcloud server block needs to be changed?

@marinofaggiana any news for us?

I sent an email to iOS at Nextcloud. They attempted to upload a 100mb file and ran into the issue we are all talking about here to my server. They said “Yup, doesn’t work. Issue is on your side”. I responded back stating that everything works just fine if you log in through a web browser and asked for additional information. I haven’t heard anything back. Once again that’s fine if there’s an issue with some setting server-side with the iOS app, but I want to know what setting that is. I’m struggling with the fact that this seems to work for everything BUT the iOS app yet the issue is with all of our configurations, not the iOS app.

I sent an email to iOS at Nextcloud. They attempted to upload a 100mb file and ran into the issue we are all talking about here to my server. They said “Yup, doesn’t work. Issue is on your side”. I responded back stating that everything works just fine if you log in through a web browser and asked for additional information. I haven’t heard anything back. Once again that’s fine if there’s an issue with some setting server-side with the iOS app, but I want to know what setting that is. I’m struggling with the fact that this seems to work for everything BUT the iOS app yet the issue is with all of our configurations, not the iOS app.

yeap.. they doesnt seem to care on explaining why the iOS app is the only part that doesnt work..

@marinofaggiana
It is a Bug of the iOS App!!!
Same File to the Same Server with the AndroidApp works.
So what could it be?

@ArnaudFeld , I think that Android App use the chunk , correctly @tobiasKaminsky ?

@marinofaggiana yes, we do use chunked upload for files > 1Mb.
This is the doc: https://docs.nextcloud.com/server/stable/developer_manual/client_apis/WebDAV/chunking.html

yes, @ArnaudFeld as you see this is the difference, but this is not an issue of client.

p.s. this is in todo but is not an priority

But why is the way of uploading different between Android-and iOS-App?

What is for you the issue? The Server?

yes, @ArnaudFeld as you see this is the difference, but this is not an issue of client.

Then what is the Issue? Why is the Android (in this case) without Problem? WHY???

Please check that the data is sent as multipart and the boundaries are correct, otherwise, when sending as application/json the string will go on the URL and you will get 413, because a PDF or other big thing will produce too many strings to go on the URL.

@JPBoero
And how do i this?

Why did the Android Version of the App works and the iOS Version Not?

Hi all, I understand the frustration with upload issues, but please understand we work as hard as we can but the iOS client is largely done by one person and he has to focus on customer issues as that is how he (well, our company) gets paid... Coding and debugging help is of course very welcome, but besides that I'm afraid there isn't much that can be done. Please try to stay polite and provide debugging info and test accounts!

@jospoortvliet we do understand times and money issues, but when he said that is not the client and every other client works.. then the least that he could do is to throw us some hints about what the problem is so we can troubleshoot ourselves. Right now the frustration comes from the fact that he is keeping us in the dark for an issue where he seems to have information not present on this thread (e.g Chunked upload?).

I didnt agree when they talked about posting negative reviews on the AppStore, but when you see comments like:
"We have over 800.000 users ... maybe the problem is not the iOS ... have you thought about it ?"
is kind of inviting you to do it..

@netpanda if you read all the posts here it says how to increase the possibility of doing bigger uploads, and I repeat that the problem is not iOS but server configuration.

The possibility of using the chunk in iOS has not yet been implemented (the driver still does not allow it) and is currently not a priority.

@jospoortvliet @marinofaggiana I, like many on here, have made the suggested server changes yet continue to have these issues. I’m assuming you guys have a server which is configured and working with the iOS app for 100+mb uploads.

  1. Could you share your server setup and any configuration files which could help the rest of us re-configure our servers appropriately?

  2. Could you create a test login which we can also test uploading larger files?

Thanks.

@rkratochvil

My nginx config:

matt@server:~$ cat /etc/nginx/sites-enabled/nextcloud
server {
    server_name  nextcloud.xxxxxxx.com www.nextcloud.xxxxxxx.com;
    client_max_body_size 0;

    access_log  /var/log/nginx/nextcloud_access.log;
    error_log   /var/log/nginx/nextcloud_error.log;

    location / {
        proxy_pass http://localhost:9006/;
        proxy_set_header Host $host;

        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/xxxxxxxxxxxxxx; # managed by Certbot
    ssl_certificate_key /etc/zxxxxxxxxxx; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf;
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;


}

server {
    if ($host = nextcloud.xxxxxxx.com) {
        return 301 https://$host$request_uri;
    }

    if ($host = www.nextcloud.xxxxxxx.com) {
        return 301 https://nextcloud.xxxxxxx.com$request_uri;
    }

    listen       80;
    server_name  nextcloud.xxxxxxx.com www.nextcloud.xxxxxxx.com;
    return 404;
}

As I said, I think I'm no longer having problems with my setup, but I've created a test user if you want to PM me (username at gmail) and try uploading a file you know doesn't work with your server.

Just tried a 1GB file upload and recorded the results with no issues:

2019-05-02 12.01.16 5160.zip

Thanks,

Matt

Thanks to Matt’s help I can confirm that the app works. Hate to say it but it is something with our config’s on our server. I just uploaded a 114mb .MOV file from my iPad using the Nextcloud app. Time to dive into the configs and figure out what’s wrong. I’ll post my findings here. Thank you again @mattie47 for your help. I’m sure I’ll be hitting you up with some questions if that’s ok.

Ok. I got mine working. Let me walk you all through it.

My setup is taken from the linux.io server walkthrough found here: https://blog.linuxserver.io/2017/05/10/installing-nextcloud-on-unraid-with-letsencrypt-reverse-proxy/

Matt had sent me his config and I was comparing them. When I looked at my letsencript config I noticed this:

location / {
proxy_pass https://localhost:444/;
proxy_max_temp_file_size 10240m;
include /config/nginx/proxy.conf; <-----THAT RIGHT THERE
}

See that "include"... I looked into that. Sure as s--t it had:
client_max_body_size 10m;
client_body_buffer_size 128k;

changed that body size to 0 and buffer size to 400m, everything started working perfectly.

So, to people who are running into this issue I cannot stress this enough: Somewhere in some config you most likely have "client_max_body_size 10m". You want to change that to client_max_body_size 0. Depending on your setup this could be in one of many places. For me personally I had to change it in 3 different locations. Best of luck to all. I'll continue watching this issue and help out where I can. I understand how frustrating it can be.

I have the same issue in my case. (NextCloud 16.0.1 with Nginx reverse proxy, iOS APP 2.23.7.9 on iPhone 8P+iOS 12.3.2)

I tried @rkratochvil's suggestion but I just change "client_body_buffer_size" to 0 in my nginx.conf, not having "client_body_buffer_size".

Then I uploaded plenty of files like lots of small images <40M, 62.9MB .exe, 130.4MB .mkv, 1.12GB .mp4, 4.14GB .ZIP. All files uploaded sucessfully except 4.14GB ZIP failed which was noticed "can't read file".

So it works with big files now. At last, I also added "client_body_buffer_size 5000m" back into nginx.conf but the ZIP still failed to be uploaded.

Hope someone can resolve this.

This might be unique to me, but I found that unlike the web client, the ios app was consuming RAM through the nginx reverse proxy buff/cache when uploading larger files. The RAM would run out and then restart the upload in a continues cycle. Adding "proxy_request_buffering off;" in the location block prevented the caching and allowed for the larger files to be uploaded.

location / {
      proxy_request_buffering off;
     }

This bug is present for over 2 years. Movies simply are not being uploaded when having 500MB+ file size! Seems not to be on the server side if I look at this issue report. My server is nginx only, no reverse proxy.

...

I tried uploading from my phone some 400MB videos but had no issues doing so in the app.
I then tried doing the exact same steps as @ntompson's first post in safari with a 22M

maybe try a 600 mb file instead, my issue starts from 400 / 500. I read most of the reports here use a docker setup. In my case the server is build on the install instructions with Nginx / Redis.

Please try to reproduce it with a lager file and see if you run into the same issue. Could be one of the Nginx / SSL / php-fpm settings which only applies to the way the iOS client uploads.

This might be unique to me, but I found that unlike the web client, the ios app was consuming RAM through the nginx reverse proxy buff/cache when uploading larger files. The RAM would run out and then restart the upload in a continues cycle. Adding "proxy_request_buffering off;" in the location block prevented the caching and allowed for the larger files to be uploaded.

location / {
      proxy_request_buffering off;
     }

Which config file are you exactly referring to?

@influenist the chunked upload is in ToDo list but is not urgent. sorry

@influenist I apologize for not being more specific. The code I referenced was added to the etc/nginx/sites-enabled file. I added it to the individual "server {" section. I have added my configuration as a reference. Hope that helps. With my specific setup I have the latest Nextcloud docker image running behind nginx as a reverse proxy:

NEXTCLOUD

server {
listen 80;

server_name yourserver;
return 301 https://$host$request_uri;

}

server {
listen 443 ssl http2;

server_name yourserver;

location = /.well-known/carddav {
    return 301 $scheme://$host/remote.php/dav;
}
location = /.well-known/caldav {
   return 301 $scheme://$host/remote.php/dav;
}

location / {
    proxy_pass http://yournextcloudcontainerip;
    aio threads;
    proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header        X-Forwarded-Proto https;
    proxy_set_header        X-Forwarded-Proto $scheme;
    proxy_set_header        Host $http_host;
    proxy_intercept_errors  on;
    proxy_set_header   X-Forwarded-Host $server_name;
    proxy_redirect     off;
    proxy_request_buffering off;

}

ssl_certificate     location to your certs
ssl_certificate_key  location to your certs
ssl_protocols      your protocols
ssl_ciphers  your ciphers

}

don't forget to reload or restart nginx for your changes to take affect.

My problem seemed to be resolved by adjusting the max upload size. /etc/ningx/conf.d/nextcloud.conf

    # set max upload size
    client_max_body_size 5G;
    client_body_buffer_size 0;

This resolved the issue. Next to this you can set a max upload size from the Nextcloud administration settings, yet this seems to effect a different config flag.

After 2 days of trying to fix this iOS 413 error I found out that CloudFlare is the issue here. Their free tier do not support big chunks of files

After 2 days of trying to fix this iOS 413 error I found out that CloudFlare is the issue here. Their free tier do not support big chunks of files

This may be one reason, but it is not the main reason for this issue, because e.g. I do not use CloudFlare at all and I run into this error too.

@ArnaudFeld , I think that Android App use the chunk , correctly @tobiasKaminsky ?

Hey @marinofaggiana something after this long time that iOS is Using Chunk for Uploading?

I am running NextCloud on a shared hosting server. I do not believe I have the ability to edit the conf file. Is there a configuration solution to solve the 413 error for shared hosting services and iOS?

I am running NextCloud on a shared hosting server. I do not believe I have the ability to edit the conf file. Is there a configuration solution to solve the 413 error for shared hosting services and iOS?

The Solution is that the iOS App should make the Upload like the Android App (using Chunk for Upload) but no changes since long time :(

Hey @marinofaggiana something after this long time that iOS is Using Chunk for Uploading?

Im currently getting this error, made sure that the nextcloud server allows file uploads of up to 1GB (edited the php values for post_max_size => 1024M and upload_max_filesize => 1024M) but Im still getting a 413 on many files. I also restarted the iOS app and Im running out of ideas, anything else I should check?

Hi all, the chunk is incompatible with background mode so I can't create this feature, any idea ?

@Ivansss your opinion?

I would not mind leaving the app running (on the foreground) while uploading large files, for my use case most of my files are under 10MBs and uploading in the background worked fine. For those large files I do not mind to have the app display the badge with the counter for how many files need to be "manually" transferred.

@purefan yes but I don't know if a file must be uploaded in foreground or in background mode ....
 

how about capturing the files that fail to upload with a 413 error code and put them in a separate queue? When pressing the + button, in the "popup" menu with "Upload photos or videos", "Upload file"... there could be an option to "Retry failed uploads", it could go to the same view for the normal Transfers, maybe a message somewhere saying "Retrying failed uploads requires the app to stay open"?

mmm for the normal user its' incompressible... for example upload a file of 100 MB return error 413, I capture the error and retry with the chunk option of 1MB for file (100 files) so start a new upload for 100 files but when you move the app in background the upload is very very slowly and it may take several hours / days ...the Apple write: for upload in background of several file please create a single zip file for send it in your server.
No, send a file chunked in background is not possible.

I mean something like this:

  • User enables automatic file upload
  • User takes a photo (2MBs) and a video (120MB)
  • The Nextcloud app runs in the background and tried to upload both files not using chunks.
  • The Nextcloud app succeeds in uploading the photo.
  • The Nextcloud app fails to upload the video. Now the app displays the badge with the counter of failed uploads (1 in this example, because of the video).
  • The user sees the badge and goes into the app and tries to upload the video again, this time the app will try chunks and require to stay in the foreground.

If you want to make it smarter you can keep a variable with the biggest file that was successfully uploaded, and that will tell how big each chunk needs to be.

mmm for the normal user its' incompressible... for example upload a file of 100 MB return error 413, I capture the error and retry with the chunk option of 1MB for file (100 files) so start a new upload for 100 files but when you move the app in background the upload is very very slowly and it may take several hours / days ...the Apple write: for upload in background of several file please create a single zip file for send it in your server.
No, send a file chunked in background is not possible.

And uploading a file chunked when the app is in foreground? Is that possible?

@marinofaggiana is the Idea of @purefan not a solution for the moment?

Hello everyone, I am experiencing this issue. I am running Nextcloud on docker.
The video I am trying to upload via the Nextcloud IOS client is 300MB in size.

Here are my config files (relevant content shown):
nginx.conf:

client_max_body_size 10G;

uploadsize.conf:

client_max_body_size 10G;
proxy_request_buffering off;

php.ini:

upload_max_filesize = 2048M
post_max_size = 2048M
max_execution_time = 200

I have tried altering both the values of client_max_body_size in both nginx.conf and uploadsize.conf to 0; and then restarting the nginx and fpm containers. I still receive the 413 error in the IOS client.

Any suggestions? Thanks everyone.

EDIT: I am using Cloudflare. I see someone else has identified that Cloudflare is the issue here?

EDIT: I am using Cloudflare. I see someone else has identified that Cloudflare is the issue here?

Hello, I have the same problem as you and I'm also using Cloudflare.

I found out Cloudflare has some size limitation on HTTP request :
100MB Free and Pro
200MB Business
500MB Enterprise by default

Their solution is to either:

  • chunk requests smaller than the upload thresholds, or
  • upload the full resource through a grey-clouded DNS record.

https://support.cloudflare.com/hc/en-us/articles/200172516-Understanding-Cloudflare-s-CDN

cloudflare

Cloudflare was also the issue for me when using the auto upload camera roll feature, I was continually getting error 413 for failed uploads; it was failing for even relatively small items (images/videos).

FYI by “grey clouded” DNS record, what the Cloudflare documentation (great link above) is referring to is the disabled state of any Cloudflare proxy processing of requests which can improve performance and security. This is done by disabling the proxy status of the DNS record in the DNS tab of Cloudflare.

In my case I have a CName record pointing to my primary DNS entry which has proxy’ing enabled, however by disabling the proxy for that one record that I use for NextCloud (e.g. make it show a “grey cloud” vs “orange cloud” icon) the uploads started to work for me as expected.

I also ran into this with an 1.05 GB video file. There are two scenarios:

1) I upload from within the app - then the upload dialog just closes without queueing the file. There is no user feedback. It only closes the upload dialog once you click "Upload".
2) If you use the share sheet from the photos app and share to Nextcloud. Then you select the folder and once you click upload you get this not very helpful prompt:

IMG_5785

If it is not working right now, then a proper error would help a lot to avoid confusion of the user.

Also we need to look into a way of fixing this. maybe @Ivansss can help here.

ops. error do not codified; done in the new driver.

I think @marinofaggiana misunderstood my suggestion. Let me try to explain in a different way:

  • The upload flow stays the same as it is right now
  • Currently, when an upload files we have a badge counter
  • What I suggest is to have the option to re-try the large files that failed to upload, telling the user to keep the app open while uploading those files.

This would make the upload on the foreground, not on the background, and then it can be chunked

@purefan thanks for your suggestion but is very complicated this material because the upload/download system under iOS (NSURLSession) are not easily manageable when you start, but soon, I hope, we need rewrite this point and we search a solution ... but you think normal users, and they are 99%, select the file(s) and move the app in background or close the phone, there are no ways to explain the background/foreground/big file chunked, etc.
If we choice your suggestion the 99% will complain that it doesn't work; for example when create video and send it via autoupload :-)

Getting this error too over Cloudflare while trying to upload any of my videos from a new iPhone. Video is only 350MB, but I get a 413 right away.

No way to upload any videos with my new iPhone on my Nextcloud Server. I have to manually move it over via computer...

Any videos over 100MB can't send. Happens across all iOS devices we have trying to sync with our Nextcloud server. This doesn't happen on Android! Can anyone fix this to be like Android?

Getting this error too over Cloudflare while trying to upload any of my videos from a new iPhone. Video is only 350MB, but I get a 413 right away.

CF limits plain uploads (PUT) to 100 MB (see previous comment https://github.com/nextcloud/ios/issues/396#issuecomment-621488641)

Cloudflare limits upload size (HTTP POST request size) per plan type:

  • 100MB Free and Pro
  • 200MB Business
  • 500MB Enterprise by default (contact Customer Support to request a limit increase)

(Source)

This doesn't happen on Android! Can anyone fix this to be like Android?

Android app uploads in tiny chunks. See related issues for chunking support: https://github.com/nextcloud/ios/issues/914 https://github.com/nextcloud/ios/issues/1275

Hi
Seeing all the issues somehow related with file/photo upload I believe the upload shall be reviewed and maybe looked at in a whole.

I see two different kind of uploads

  • automatic upload of the photo roll
  • upload files in and / synchronizing folders

I don't know how the second is handled as I see the webdav in charge here, but for the first I'd like to see chunked uploads and a slightly different upload queue.
Uploads in queue can have different states:

  • Not started uploading
  • Upload failed where is can either be resumed or failed completely
  • Successfulls uploaded

I would like to see those in three sections in the upload queue wiht the ability to clear all of a state, like remove only the successful uploaded files.
The files failed uploading shall be marked if the upload can't be resumed .. like the source file has been deleted or is not longer accessible.
If upload failed due to e.g server not reachable, the upload shall be retried.

With this I would have a info on what went wrong and when a files has not been uploaded and why.

For using chunks for upload the queue needs to hold information on the file uuid for the upload and how far it has been uploaded already (we have a progress info already). With this it shall be possible to resume upload with the chunk upload api.
How long chunks are stored before cleanup on the server can be configured on the server. A resume needs to check if chunks are still there.

My experience is that when using cell data the uploads fail quite often depending on the quality of the connection. And needs to be always restarted from the beginning ... which causes a lot of traffic, keeps the queue longer than neccessary and delays uloads until it succeeds.
The chunked upload shall solve a number of issues still open.

I am also running into this problem where the lack of chunking prevents files >= 100MB from being uploaded through Cloudflare.

The issue has made me switch entirely to Android!

Getting this error too over Cloudflare while trying to upload any of my videos from a new iPhone. Video is only 350MB, but I get a 413 right away.

CF limits plain uploads (PUT) to 100 MB (see previous comment #396 (comment))

Cloudflare limits upload size (HTTP POST request size) per plan type:

  • 100MB Free and Pro
  • 200MB Business
  • 500MB Enterprise by default (contact Customer Support to request a limit increase)

(Source)

This doesn't happen on Android! Can anyone fix this to be like Android?

Android app uploads in tiny chunks. See related issues for chunking support: #914 #1275

Ridiculous that even if I upgrade to Enterprise on Cloudflare, I won't be able to upload a standard 4k video from my iPhone because how the iOS version of this app uploads data.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TecJon picture TecJon  Â·  5Comments

helmut72 picture helmut72  Â·  4Comments

rakekniven picture rakekniven  Â·  4Comments

AxelGard picture AxelGard  Â·  4Comments

MarcusE1W picture MarcusE1W  Â·  5Comments