Problems with uploading file over 1MB

Hello,
I have migrated my Nextcloud instance from one server to another. Previously I have used nginx and mariadb natively on openmediavault4 system, now I have moved to official Docker image on different machine in phisically different location. I managed to restore database and data directory on my new setup and made nginx redirection to new subdomain so now even old links from previous setup do work.
My current setup consists of reverse proxy consisting of container based on linuxserver/swag image with redirection configured to my nextcloud container like so:

server {
        listen 443 ssl;
        client_max_body_size 0;

                location /.well-known/carddav {
                        return 301 $scheme://<subdomain><main_domain>/remote.php/dav;
                }

                location /.well-known/caldav {
                        return 301 $scheme://<subdomain><main_domain>/remote.php/dav;
                }

        root /config/www;

        server_name <subdomain><main_domain>;

        include /config/nginx/ssl.conf;

        location / {
                include /config/nginx/proxy.conf;
                proxy_pass http://<nextcloud_container_ip_and_port>;
        }
}

With this setup I am unable to upload files over 1MB from android client, every other client works. I am able to upload large files using Nextcloud Destkop client, WebUI and by connecting to my instance via WebDAV using file manager from Mint Cinnamon.

While troubleshooting this issue, I’ve came to conclusion, that Android client behavior differs based on filesize. For files under 1MB it works correctly:

<some_ip> - - [15/Oct/2021:12:16:44 +0200] "GET /ocs/v2.php/cloud/user?format=json HTTP/2.0" 401 106 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.17.0"
<some_ip> - - [15/Oct/2021:12:16:45 +0200] "GET /index.php/204 HTTP/2.0" 204 0 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.17.0"
<some_ip> - <my_user_name> [15/Oct/2021:12:16:45 +0200] "HEAD /remote.php/webdav/Test/received_1822133364617900.jpeg HTTP/1.1" 404 0 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.17.0"
<some_ip> - <my_user_name> [15/Oct/2021:12:16:47 +0200] "PUT /remote.php/webdav/Test/received_1822133364617900.jpeg HTTP/1.1" 201 0 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.17.0"
<some_ip> - <my_user_name> [15/Oct/2021:12:16:47 +0200] "PROPFIND /remote.php/webdav/Test/received_1822133364617900.jpeg HTTP/1.1" 207 886 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.17.0"
<some_ip> - <my_user_name> [15/Oct/2021:12:16:48 +0200] "GET /index.php/apps/files/api/v1/thumbnail/256/256/Test/received_1822133364617900.jpeg HTTP/1.1" 200 13117 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.17.0"

Here is the log for file over 1MB:

big file:
<some_ip> - <my_user_name> [15/Oct/2021:14:09:50 +0200] "GET /ocs/v2.php/apps/files_sharing/api/v1/shares?path=%2FTest%2F&reshares=true&subfiles=true HTTP/1.1" 200 138 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.17.0"
<some_ip> - <my_user_name> [15/Oct/2021:14:09:51 +0200] "PROPFIND /remote.php/dav/uploads/<my_user_name>/30d7596a7408f21aab0dade1e7a9b1e8 HTTP/1.1" 207 780 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.17.0"
<some_ip> - <my_user_name> [15/Oct/2021:14:09:52 +0200] "PUT /remote.php/dav/uploads/<my_user_name>/30d7596a7408f21aab0dade1e7a9b1e8/0000000000000000-0000000001748605 HTTP/1.1" 201 0 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.17.0"

After this line, I get notification on my Android device saying

Upload failed
Could not complete operation. Server unavailable.

I 've tried to connect to my instance locally by connecting via IP address in my local network directly. It worked only after commenting this line from my config.php:

'overwriteprotocol' => 'https',

I have added it by my own, because without it I am unable to login from my local network using Desktop Client. However, with this line commented out, I am able to login correctly using local network address on my Android phone and then uploading large files works. Please see logs attached:

<some_ip> - <my_user_name> [15/Oct/2021:10:31:27 +0000] "GET /ocs/v2.php/cloud/user?format=json HTTP/1.1" 200 1946 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.17.0"
<some_ip> - - [15/Oct/2021:10:31:27 +0000] "GET /index.php/204 HTTP/1.1" 204 1336 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.17.0"
<some_ip> - <my_user_name> [15/Oct/2021:10:31:27 +0000] "HEAD /remote.php/webdav/Test/IMG_1208.JPG HTTP/1.1" 404 537 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.17.0"
<some_ip> - <my_user_name> [15/Oct/2021:10:31:27 +0000] "PROPFIND /remote.php/webdav/Test/ HTTP/1.1" 207 1426 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.17.0"
<some_ip> - <my_user_name> [15/Oct/2021:10:31:27 +0000] "MKCOL /remote.php/dav/uploads/<my_user_name>/32af58170ada56b58f11b20af409a978 HTTP/1.1" 201 548 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.17.0"
<some_ip> - <my_user_name> [15/Oct/2021:10:31:27 +0000] "PROPFIND /remote.php/dav/uploads/<my_user_name>/32af58170ada56b58f11b20af409a978 HTTP/1.1" 207 1495 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.17.0"
<some_ip> - <my_user_name> [15/Oct/2021:10:31:27 +0000] "PROPFIND /remote.php/webdav/Test/ HTTP/1.1" 207 13040 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.17.0"
<some_ip> - <my_user_name> [15/Oct/2021:10:31:28 +0000] "GET /ocs/v2.php/apps/files_sharing/api/v1/shares?path=%2FTest%2F&reshares=true&subfiles=true HTTP/1.1" 200 887 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.17.0"
<some_ip> - <my_user_name> [15/Oct/2021:10:31:27 +0000] "PUT /remote.php/dav/uploads/<my_user_name>/32af58170ada56b58f11b20af409a978/0000000000000000-0000000004282304 HTTP/1.1" 201 730 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.17.0"
<some_ip> - <my_user_name> [15/Oct/2021:10:31:28 +0000] "MOVE /remote.php/dav/uploads/<my_user_name>/32af58170ada56b58f11b20af409a978/.file HTTP/1.1" 201 872 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.17.0"
<some_ip> - <my_user_name> [15/Oct/2021:10:31:29 +0000] "PROPFIND /remote.php/webdav/Test/IMG_1208.JPG HTTP/1.1" 207 1478 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.17.0"
<some_ip> - <my_user_name> [15/Oct/2021:10:31:29 +0000] "GET /index.php/apps/files/api/v1/thumbnail/256/256/Test/IMG_1208.JPG HTTP/1.1" 200 30972 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.17.0"
<some_ip> - - [15/Oct/2021:10:31:36 +0000] "GET /index.php/204 HTTP/1.1" 204 1336 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.17.0"

Note that on the previous log, “MOVE” request is missing which I believe is the cause for upload not working. Why is that? How to troubleshoot this problem? I am not seeing any entry in proxy’s nginx error.log. I am trying to troubleshoot this problem for three days now and I’ve ran out of ideas, so any help will be appreciated. Is ISP to blame here?

EDIT:
I’ve redirected all the traffic on my 443 port to Nextcloud container and omitting SWAG. Then my files started to upload correctly:

<some_ip> - <my_user_name> [15/Oct/2021:15:24:51 +0200] "GET /ocs/v2.php/cloud/user?format=json HTTP/1.1" 200 1947 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.17.0"
<some_ip> - - [15/Oct/2021:15:24:52 +0200] "GET /index.php/204 HTTP/1.1" 204 1330 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.17.0"
<some_ip> - <my_user_name> [15/Oct/2021:15:24:52 +0200] "HEAD /remote.php/webdav/Test/2019-09-09%20CGM%20CLININET%20PL.pdf HTTP/1.1" 404 537 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.17.0"
<some_ip> - <my_user_name> [15/Oct/2021:15:24:52 +0200] "MKCOL /remote.php/dav/uploads/<my_user_name>/e52543b0ef009f569318398ba697664f HTTP/1.1" 201 548 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.17.0"
<some_ip> - <my_user_name> [15/Oct/2021:15:24:52 +0200] "PROPFIND /remote.php/dav/uploads/<my_user_name>/e52543b0ef009f569318398ba697664f HTTP/1.1" 207 1495 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.17.0"
<some_ip> - <my_user_name> [15/Oct/2021:15:24:52 +0200] "PROPFIND /remote.php/webdav/Test/ HTTP/1.1" 207 1420 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.17.0"
<some_ip> - <my_user_name> [15/Oct/2021:15:24:52 +0200] "GET /ocs/v2.php/apps/files_sharing/api/v1/shares?path=%2FTest%2F&reshares=true&subfiles=true HTTP/1.1" 200 887 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.17.0"
<some_ip> - <my_user_name> [15/Oct/2021:15:24:52 +0200] "PUT /remote.php/dav/uploads/<my_user_name>/e52543b0ef009f569318398ba697664f/0000000000000000-0000000010239999 HTTP/1.1" 201 730 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.17.0"
<some_ip> - <my_user_name> [15/Oct/2021:15:24:54 +0200] "PUT /remote.php/dav/uploads/<my_user_name>/e52543b0ef009f569318398ba697664f/0000000010240000-0000000015398452 HTTP/1.1" 201 730 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.17.0"
<some_ip> - <my_user_name> [15/Oct/2021:15:24:55 +0200] "MOVE /remote.php/dav/uploads/<my_user_name>/e52543b0ef009f569318398ba697664f/.file HTTP/1.1" 201 872 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.17.0"
<some_ip> - <my_user_name> [15/Oct/2021:15:24:55 +0200] "PROPFIND /remote.php/webdav/Test/2019-09-09%20CGM%20CLININET%20PL.pdf HTTP/1.1" 207 1510 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.17.0"

Notice that sometimes files get split to 1MB chunks and sometimes not, but it doesn’t make any difference. Now it has to do something with my proxy configuration not allowing MOVE requests, but I fail to find appriopiate directives/settings. I guess I should write on some nginx forums…

goddammit! It was that redirection to old server all the time! I’ve reinstalled the Android Client and everything now works correctly. When I moved to new setup I haven’t changed the connection parameters - Android App just switched to new server based on nginx redirection I made on the old one, only requesting for me to login again. It seems that some requests were still being forwarded to old server though. Maybe that’s a bug I just found?