Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(mobile): uploading files in chunk #2101

Merged
merged 1 commit into from
Mar 28, 2023

Conversation

perryizgr8
Copy link
Contributor

If your server is running behind a CloudFlare tunnel, the Flutter app fails to upload files larger than 100 MB. This can be solved if we add a Transfer-Encoding: chunked header to the request.

@vercel
Copy link

vercel bot commented Mar 28, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated
immich ⬜️ Ignored (Inspect) Mar 28, 2023 at 3:32PM (UTC)

@alextran1502
Copy link
Contributor

Have you had a chance to test it with your Cloudflare tunnel setup? Can you also test with a local IP on your server?

@perryizgr8
Copy link
Contributor Author

I tested this with my CloudFlare tunnel setup with a ~200 MB video and it uploaded without problems. This video consistently fails to upload with the Play Store build of the app.

I am unable to test with my local IP, the app says: TLS/SSL communication failed: POST /oath/config

@perryizgr8 perryizgr8 marked this pull request as ready for review March 28, 2023 16:42
@alextran1502 alextran1502 linked an issue Mar 28, 2023 that may be closed by this pull request
@alextran1502 alextran1502 changed the title Add Transfer-Encoding: chunked to request header when uploading files feat(mobile): uploading files in chunk Mar 28, 2023
@alextran1502 alextran1502 merged commit b49f66b into immich-app:main Mar 28, 2023
@michelheusschen
Copy link
Contributor

This doesn't actually do chunked uploading like the linked issue describes, right? This only kind of abuses the HTTP/1.1 specification to bypass the length check of Cloudflare, as tested by the PR author. Are regular reverse proxies still able to correctly process such requests? And shouldn't at least a comment be included that states why this header is present at all for future reference? And could this break with HTTP/2 requests?

@alextran1502
Copy link
Contributor

@michelheusschen Good info. I did a test with Caddy with default HTTP/3 support, and I can upload a large video.

@bo0tzz
Copy link
Member

bo0tzz commented Mar 28, 2023

Did that Caddy instance still have HTTP/1.1 enabled though? It will negotiate a protocol.

@alextran1502
Copy link
Contributor

@bo0tzz I will fall back to HTTP/1.1 caddyserver/caddy#4707 (comment)

@perryizgr8
Copy link
Contributor Author

It's true that this is not real "chunking". It just omits the content length so that CloudFlare doesn't respond with HTTP 413. Once a request is already underway, it's more complicated to track the amount of data transfered and kill the connection midway, so they don't seem to do that and our file goes through.
However this does solve an immediate showstopper problem for people with similar setups. Thanks for merging.

@perryizgr8 perryizgr8 deleted the chunked-encoding branch March 29, 2023 04:05
@pl4nty
Copy link

pl4nty commented May 13, 2023

Does anyone mind if I port this to the web client? Not as robust as tus or exposing uploads on a separate hostname, but it'll work for now

@daschillinger
Copy link

Will this work on the ios app? Or is this already solved? I need the cloudflare tunnel as I don't get into my homenetwork on other ways.

@mchiappinam
Copy link

Will this work on the ios app? Or is this already solved? I need the cloudflare tunnel as I don't get into my homenetwork on other ways.

I have the same question here... did you found anything related to that?

@mchiappinam
Copy link

Looks like this was "resolved" on release 1.52.0, however yesterday I was running into issues while uploading videos, using cloudflare instead of the direct IP or another proxy domain with the cloudflare "cloud" OFF. Anyone with the same issue?

@lasdem
Copy link

lasdem commented May 22, 2024

I installed immich yesterday and I also have the issue that large files > 100MB will fail on the Web Client when using cloudflare tunnel and on the App as well.

@daschillinger
Copy link

I uploaded a video with 200mb this morning with my phone through the tunnel and it works. I am running version 1.103.1 atm
I don’t jump on every release and update about once a month
Did you guys update the software for cloudflare as well?

@lasdem
Copy link

lasdem commented May 22, 2024

immich server: v1.105.1 (installed through docker compose)
immich app android: Version 1.105.0 app.alextran.immich
Cloudflare tunnel Version 2024.5.0

Uploading through local UI works, but through the tunnel both app and webui fail.
I am pretty sure its because of Cloudflare, but I don't know how I could make it so that either large files are uploaded local wifi directly or that they are uploaded in chunks.
Are there any relevant logs I could attach

@bo0tzz
Copy link
Member

bo0tzz commented May 22, 2024

Folks, this PR is nearly a year old now, so let's not continue discussing in here. If you want actual chunked uploading, you can subscribe to #1674. If you need troubleshooting help, please open a new discussion.

@immich-app immich-app locked as off-topic and limited conversation to collaborators May 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: Upload large files in chunks
8 participants