Haproxy http2 slow uploads from outside fix

I realized my nextcloud instance was affected by this problem when a friend asked me to run some tests on his newly built nextcloud installation. We were comparing speeds and the upload speeds on my instance always peaked at 2.6 mb/s while his could reach 10 mb/s.

Long story made short (after spending a lot of time trying to figure out what was causing this) : I’m using the h2 option on haproxy (used for ssl offloading) and this is why upload speeds are limited.

Sets the HTTP/2 initial window size, which is the number of bytes the client can upload before waiting for an acknowledgment from haproxy. This setting only affects payload contents (i.e. the body of POST requests), not headers. The default value is 65535, which roughly allows up to 5 Mbps of upload bandwidth per client over a network showing a 100 ms ping time, or 500 Mbps over a 1-ms local network. It can make sense to increase this value to allow faster uploads, or to reduce it to increase fairness when dealing with many clients. It doesn’t affect resource usage.

Fix : use tune.h2.initial-window-size 1048576