nginx and immich on truenas

I am trying to setup access to immich through nginx reverse proxy, but the link seems to redirect to the truenas login page instead of immich's.
Anything look wrong in my nginx config?
# Immich Configuration
server {
    listen 443 ssl;
    server_name public_url;

    ssl_certificate /etc/letsencrypt/live/public_url/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/public_url/privkey.pem;

    # allow large file uploads
    client_max_body_size 50000M;

    # Set headers
    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;

    # enable websockets: http://nginx.org/en/docs/http/websocket.html
    proxy_http_version 1.1;
    proxy_set_header   Upgrade    $http_upgrade;
    proxy_set_header   Connection "upgrade";
    proxy_redirect     off;

     # set timeout
    proxy_read_timeout 600s;
    proxy_send_timeout 600s;
    send_timeout       600s;

    location / {
        proxy_pass https://truenas_addr:30041;
    }
}
Was this page helpful?