Invalid request in nextcloud client app

this is a follow up for https://github.com/nextcloud/server/issues/8956. to quickly summarize: desktop (gnome) client works normally, android client refuses to work and gives “invalid request” error. nextcloud developer suggested to make sure that auth headers are not stripped. to achieve that i put proxy_pass_header into my nginx reverse proxy config:

server {
  server_name cloud.secret.com;
  listen 443 ssl;
  ssl on;
  ssl_certificate /var/lib/dehydrated/certs/cloud.secret.com/fullchain.pem;
  ssl_certificate_key /var/lib/dehydrated/certs/cloud.secret.com/privkey.pem;
  location ^~ /.well-known/acme-challenge/ {
    alias /var/www/dehydrated/;
    default_type text/plain;
  }
  location / {
    access_log  /var/log/nginx/access.log upstreamlog;
    proxy_pass  http://nextcloud;
    proxy_redirect off;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_pass_header Authorization;
  }
}

the issue still persists. please can you advise?

Nextcloud 14.0.3 on Alpine Linux, PHP-FPM7
Nginx Reverse proxy listening on https
Nginx upstream host forwarding requests to Nextcloud

resolved by configuring “overwritehost” and “overwriteprotocol” in config.php as specified at https://docs.nextcloud.com/server/11/admin_manual/configuration_server/reverse_proxy_configuration.html#example