this post was submitted on 10 Jun 2026
17 points (100.0% liked)

Selfhosted

60177 readers
578 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

Detailed Rules Post

  1. Be civil.

  2. No spam.

  3. Posts are to be related to self-hosting.

  4. Don't duplicate the full text of your blog or readme if you're providing a link.

  5. Submission headline should match the article title.

  6. No trolling.

  7. Promotion posts require active participation, with an account that is at least 30 days old. F/LOSS without a paywall has exceptions, with requirements. See the rules link for details.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 3 years ago
MODERATORS
 

I am trying to increase the upload limit on my matrix server. I would like to push it to 500MB, but it keeps failing the upload past ~180MB. There is very little information about the failure, the client just says "Unkown error", nginx says "error 499", which means the client disconnected to quickly. Additionally, trying to recreate the failure with curl just results in a success, so the issue seems to be with the client. I tried with element-web, element desktop, element x and cinny and they all have this issue.

I run a continuwuity server on a Raspberry Pi 4B, behind two nginx reverse proxies and a rathole tunnel. Continuwuity, and the two reverse proxies run inside docker compose projects. Here is my architecture :

                   __
                 .(  ).
               (`Cloud )
                `-----`
                   |
                   V
          +- Outside server -+
          |   +---------+    |
          |   | rathole |    |
          |   +---------+    |
          +--------|---------+
                   |
+- Home network ---|-------------------------+
| +- RasPi --------|-----------------------+ |
| |                V                       | |
| |       +- tunnel docker -+              | |
| |       | +---------+     |              | |
| |       | | nginx 1 |     |              | |
| |       | +---------+     |              | |
| |       +-----|-|---------+              | |
| |             | |                        | |
| |             | +- other services -->... | |
| |             |                          | |
| |             V                          | |
| |       +- matrix docker --+             | |
| |       |   +---------+    |             | |
| |       |   | nginx 2 |    |             | |
| |       |   +---------+    |             | |
| |       |        |         |             | |
| |       | +------V-------+ |             | |
| |       | | Continuwuity | |             | |
| |       | +--------------+ |             | |
| |       +------------------+             | |
| +----------------------------------------+ |
+--------------------------------------------+

Of course, I made sure to increase the upload limit in Continuwuity :

max_request_size = 500000000

And in both nginx instances :

client_max_body_size 500M;

From what I can gather from other issues on the internet, it seems it could be related to timeout errors. Although they all seem to be talking about 2-8Gb files, I am probably running much weaker hardware than they do, so it checks out.

I tried setting the following values in both nginx instances :

location / {
    proxy_connect_timeout       600;
    proxy_send_timeout          600;
    proxy_read_timeout          600;
    send_timeout                600;
    proxy_next_upstream         off;
    proxy_buffering             off;

    proxy_pass ...;
}

And setting timeout values in Continuwuity :

client_receive_timeout = 75
client_request_timeout = 180
client_response_timeout = 120
client_shutdown_timeout = 10

Since that didn't have any effect, I bumped them by 20x and 40x respectively :

location / {
    proxy_connect_timeout       18000;
    proxy_send_timeout          18000;
    proxy_read_timeout          18000;
    send_timeout                18000;
    proxy_next_upstream         off;
    proxy_buffering             off;

    proxy_pass ...;
}
client_receive_timeout = 3000
client_request_timeout = 7200
client_response_timeout = 4800
client_shutdown_timeout = 400

But that did not have any effect. I also looked at modifying element-web's settings, but there doesn't seem to be anything related to timeouts.

I also saw that encrypted vs. unencrypted rooms might have an effect, but I got ~190MB max in encrypted rooms and ~180MB in unencrypted rooms.

Finally, I tried using curl :

curl -X POST https://server.domain/_matrix/media/v3/upload -H "Authorization: Bearer <token>" -H "Content-Type application/octet-stream" --data @200mb.file
# success
# returns a mxc:// url
curl -X POST https://server.domain/_matrix/client/v1/media/download/server.name/file_id -H "Authorization: Bearer <token>" -o 200mb_copy.file
# See that the two files are identical

I am at a loss. What can I do to solve this issue?

top 18 comments
sorted by: hot top controversial new old
[–] skankhunt42@lemmy.ca 6 points 2 weeks ago (1 children)

I'd try on the PI against the service port to remove all the extra complexity. If that doesn't work, fix it and move on to the next layer, fixing as needed until you get to the end.

[–] gyoo@lemmy.ca 1 points 2 weeks ago (2 children)

How would I do that? The curl command already works and the service is being handeld by the reverse proxy, which depends on the domain name to pass the requests correctly. Even if I succeeded, element-web is configured to send the file to the domain name, not the local address.

[–] skankhunt42@lemmy.ca 2 points 2 weeks ago

You can use the host file to point matrix.example.ca to 127.0.0.1 or whatever endpoint you want to try.

You could set up a docker container with cinny to try a different app. https://cinny.in/

I don't like elements so I avoid it, not sure what to suggest there.

[–] stratself@lemdro.id 1 points 2 weeks ago

Use the --resolve flag e.g. curl --resolve matrix.example.com:8008:127.0.0.1 https://matrix.example.com:8008/

[–] stratself@lemdro.id 5 points 2 weeks ago (1 children)

Why is there two nginx containers? Can you do nginx1 --> continuwuity?

Does continuwuity show any logs? What about nginx? Check Element Web's devtools, does the 499'd network request say anything of note?

Maybe have a chat in the support room

[–] gyoo@lemmy.ca 1 points 2 weeks ago

The idea is to have one nginx container responsible for the tls handling and request distribution (I have more than one service running on the device) and the other for actually handling the request. It keeps things organised.

[–] UxyIVrljPeRl@lemmy.world 3 points 2 weeks ago (1 children)

I darkly remember that there was another relevant size settin in matrix...

[–] suzune@ani.social 1 points 2 weeks ago (1 children)

Relevant settings from my homeserver:

max_upload_size: 10M                                                                    max_image_pixels: 32M
[–] helix@feddit.org 1 points 2 weeks ago (1 children)

That's synapse, not continuwuity, correct?

[–] gyoo@lemmy.ca 1 points 2 weeks ago

Yeah, I can't find either of those settings in the configuration docs and I wasn't just sending images.

[–] JadedBlueEyes@programming.dev 2 points 2 weeks ago (2 children)

Given nginx is logging a client disconnect error and curl succeeding, it sounds like the issue is in the client. Trying different clients and/or browsers may reveal the problem.

[–] gyoo@lemmy.ca 1 points 2 weeks ago

That's what I tought, but both cinny and element web have this issue and it sounds like people should be able to go up to 2GB.

[–] JadedBlueEyes@programming.dev 1 points 2 weeks ago

But yeah the support room is more likely to be able to help debug

[–] az04@lemmy.world 1 points 2 weeks ago (1 children)

Try caddy instead of nginx, that fixed my problems with transferring files to a self host of forgejo

[–] gyoo@lemmy.ca 1 points 1 week ago

I am thinking of trying caddy, but I don't think it's the issue. As I said, a curl command works fine, and I also have a peertube instance that takes way bigger files just fine.

[–] rumba@lemmy.zip 1 points 1 week ago (1 children)

Make sure you're not running out of ram or disk space.

[–] gyoo@lemmy.ca 1 points 1 week ago (1 children)

No I'm not. I don't have any crashes or anything of the sort and I am monitoring it very closely. Also, using curl works just fine, so it doesn't seem to be about the server...

[–] rumba@lemmy.zip 0 points 1 week ago

try adding

client_body_buffer_size 0; above proxy_request_buffering off;