Initial save of a page returns: Failed to save the page. Reason: Server not responding

Hi,

I have the problem, that the first save of a page returns:
Failed to save the page. Reason: Server not responding

After that the page is created.
This only happens when creating a page from some templates. For example a self created template or the template for a draw.io diagram. On some other templates and on plain pages, there is no problem.

I looked at the browser dev tools and found, that it must be related to my reverse proxy.

My Xwiki is running in a docker container in tomcat. For SSL termination there is a nginx reverse proxy.

When looking in the network tab when creating the page, I see that XWiki return a JSON with a http href in it. So it does not use https. After that the redirect to the http-Page fails, even if I have configured an http redirect in my nginx proxy.

I have looked a the other threads in this forum regarding the topic. But the solutions there did not help.

I already have
xwiki.url.protocol=https
xwiki.home=https://host.yourdomain.tld/
in my xwiki.cfg

Below you find my nginx config.

Any ideas where I can further look for the problem?

Best regards

nginx config:

upstream wiki.nt-domaine.local {
    server xwiki-web-1:8080;
}

server {
    server_name wiki.nt-domaine.local;
    access_log /var/log/nginx/access.log vhost;
    listen 80 ;
    location / {
        return 301 https://$host$request_uri;
    }
}

server {
    server_name wiki.nt-domaine.local;
    access_log /var/log/nginx/access.log vhost;
    http2 on;
    listen 443 ssl ;
    client_max_body_size 100M;

    ssl_session_timeout 5m;
    ssl_session_cache shared:SSL:50m;
    ssl_session_tickets off;
    ssl_certificate /etc/nginx/certs/wiki.nt-domaine.local.crt;
    ssl_certificate_key /etc/nginx/certs/wiki.nt-domaine.local.key;

    proxy_read_timeout 300;
    proxy_connect_timeout 300;
    proxy_send_timeout 300;

    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_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Scheme $scheme;
    proxy_redirect off;

    location / {
        proxy_pass http://wiki.nt-domaine.local;
    }
}