Slow file transfer speeds with haproxy reverse proxy and nextcloud on freenas

I partially solved my own problem. I moved the haproxy server to the firewall, and added this line to the global section of the haproxy.conf:

nbthread 4

This drastically improved performance for the large uploads.