Nginx reverse proxy and Nextcloud Client, not working connecting desktop client(and probably others)

Nextcloud version (eg, 12.0.2): Docker image Nextcloud 18.0.4(latest)
Operating system and version (eg, Ubuntu 17.04): Ubuntu 18.04 Docker

Hi,
Recently I setup my Nginx Reverse proxy and I added proxy to my fresh Nextcloud installation.
After changing trusted domains, I tried to connect my ubuntu 19.10 with Nextcloud client 2.5.4 to this server, but after clicking “Grant access” button, shows loading icon which nevers stops
I think that can be my nginx proxy fault.

Is this the first time you’ve seen this error? (Y/N): N

Steps to replicate it:

  1. Run docker with Nginx proxy and Nextcloud
  2. Try to get access from desktop nextcloud Client
  3. After login and pressing Grant Access button, in this button shows loading icon which never stops

My docker-compose

# Reverse Proxy
  nginx: 
    container_name: nginx
    image: nginx:latest
    restart: always
    volumes:
      - nginx-certificates:/etc/letsencrypt/live/site.pl
      - nginx-data:/etc/nginx/conf.d
    ports:
      - 80:80
      - 443:443

  mariadb-nextcloud:
    container_name: mariadb-nextcloud
    image: mariadb
    restart: always
    volumes:
      - mariadb-nextcloud-data:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=pp
      - MYSQL_DATABASE=pp
      - MYSQL_USER=pp
      - MYSQL_PASSWORD=pp

  nextcloud:
    container_name: nextcloud
    image: nextcloud
    restart: always
    volumes:
      - nextcloud-data:/var/www/html
      - nextcloud-ssl-data:/etc/ssl
      - nextcloud-apache-data:/etc/apache2
    links:
      - mariadb-nextcloud
    environment:
      - MYSQL_DATABASE=pp
      - MYSQL_USER=pp
      - MYSQL_PASSWORD=pp
      - MYSQL_HOST=mariadb-nextcloud

My nginx proxy setup


server {
    listen       80;
    server_name  nextcloud.site.pl www.nextcloud.site.pl;

    error_page   500 502 503 504  /50x.html;
    return 301 https://$host$request_uri;
}


server {
    listen       443 ssl;
    server_name  nextcloud.site.pl www.nextcloud.site.pl;
    
    resolver 127.0.0.11;
    set $upstream_server http://nextcloud;

    location / {
            proxy_pass $upstream_server;

            client_max_body_size                4G;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;

            proxy_set_header   Host $host;
            proxy_set_header   X-Forwarded-Host $server_name;
    }
    ssl_certificate /etc/letsencrypt/live/site.pl/cert1.pem;
    ssl_certificate_key /etc/letsencrypt/live/site.pl/privkey1.pem;

  client_max_body_size 0;
  underscores_in_headers on;

    ssl_stapling on;
    ssl_stapling_verify on;
}

I found solution here -Connection Wizard is looping between "Log in" and "Grant access"