Login page hangs, but logs in after hitting refresh - only when connecting through reverse proxy

OS type and version ubuntu server latest
Webmin version webmin latest

Hi, this is not a critical issue and everything else is working but I am having trouble with the login page when connecting via Nginx reverse proxy. If I use ip address and port locally it works fine.

When I access it through the nginx hostname it hangs after clicking the login button, but when I hit refresh it logs in.

This is my server block and ive redacted some private info:

Redirect all HTTP traffic to HTTPS with IPv6 support

server {
listen 80;
listen [::]:80 ipv6only=on;
server_name xxx;
return 301 https://$host$request_uri;

HTTPS server block with IPv6 support, WebSocket support, and HSTS

server {
listen 443 ssl;
listen [::]:443 ssl ipv6only=on;
server_name xxx

# SSL certificate configuration
ssl_certificate /etc/letsencrypt/live/xxx/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/xxx/privkey.pem; # managed by Certbot

# Add HSTS header
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;

# Reverse proxy configuration with WebSocket support
location / {
    proxy_pass http://192.168.0.xxx:10000; # Backend server
    proxy_set_header Host $host; # Set the Host header
    proxy_set_header X-Real-IP $remote_addr; # Forward the client's IP address
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # Forward the client's IP address
    proxy_set_header X-Forwarded-Proto $scheme; # Forward the protocol (HTTP/HTTPS)
    proxy_http_version 1.1; # Enable WebSocket support
    proxy_set_header Upgrade $http_upgrade; # Enable WebSocket support
    proxy_set_header Connection "Upgrade"; # Enable WebSocket support
    proxy_buffering off; # Disable buffering
    proxy_read_timeout 300s; # Set the read timeout to 5 minutes      
    add_header Set-Cookie "cookie_name=value; SameSite=None; Secure";


I am not seeing anything useful when I inspect the browser and I’ve tried looking through the nginx/webmin logs and see nothing of relevance. I have also looked through all the settings and tried various things to no avail. Any help much appreciated, thank you.