LocalAI icon indicating copy to clipboard operation
LocalAI copied to clipboard

Invite link not working in 5.0.1

Open pmarini-nc opened this issue 6 days ago • 3 comments

LocalAI version: 5.0.1

Environment, CPU architecture, OS, and Version:

# hostnamectl
 Static hostname: local-ai
       Icon name: computer-vm
         Chassis: vm 🖴
      Machine ID: 2f6f65079ef34e318eeeb54540ab17a3
         Boot ID: e4297a0ea4554086964beae51ce48370
  Virtualization: kvm
Operating System: Ubuntu 24.04.5 LTS              
          Kernel: Linux 6.8.0-151-generic
    Architecture: x86-64
 Hardware Vendor: QEMU
  Hardware Model: Standard PC _Q35 + ICH9, 2009_
Firmware Version: 2024.02-2ubuntu0.10
   Firmware Date: Wed 2026-09-23
    Firmware Age: 2month 2d

Describe the bug Opening an invite link gives a blank page instead of the registration form

To Reproduce Create an invite link

Expected behavior Show the registration form

Logs I can provide logs but first see if there some simple reason to break this functionality

Additional context In the same machine rolling back to 4.11.0 makes the feature works

pmarini-nc avatar Nov 25 '26 14:11 pmarini-nc

Just experienced the same... Browser complains about:

Content-Security-Policy: The page’s settings blocked the loading of a resource (base-uri) at http://my.domain.org/ because it violates the following directive: “base-uri 'self'”

as well as a disallowed MIME type.

I think it could have something to do with the head:

 <base href="http://my.domain.org/" />

It should be saying https, shouldn't it?

Workaround: If you can login via LAN or VPN connection, the invite links work if sent from a local address.

Fr4nzD13trich avatar Nov 25 '26 23:11 Fr4nzD13trich

Thanks for the report. We reproduced a blank invite page in 5.0.1 when LocalAI runs behind an HTTPS reverse proxy that is not listed in --trusted-proxies. Is that your setup?

Since 5.0.0, LocalAI believes X-Forwarded-Proto / X-Forwarded-Host only from trusted proxies. 4.11 believed them from anyone, which is why rolling back helps. Without a trusted proxy the server thinks the page is http://, and it wrote that full URL into the page's <base href>. The browser drops that base on an https:// page (CSP base-uri 'self'), so on a deep link like /invite/<code> the scripts load from /invite/assets/… and return 404. /login and /app happened to work because their relative URLs still resolve to /assets/. A reload of a deep URL such as /app/chat/<id> went blank the same way.

Fixed on master in 59d9cf997: the base href is now path-only (/, or /sub/ under a sub-path), so it is valid on any scheme. The --trusted-proxies help now also says that it controls the scheme, host and prefix headers. It ships in the next release.

Workaround until then: set LOCALAI_TRUSTED_PROXIES (--trusted-proxies) to your proxy's IP or CIDR, or set LOCALAI_BASE_URL=https://<your host>.

If you are not behind a proxy, please reopen this issue and include the browser console output from the invite page.

mudler-agent avatar Nov 25 '26 23:11 mudler-agent

I can confirm! Now the links are working again.

Fr4nzD13trich avatar Nov 25 '26 23:11 Fr4nzD13trich