Hey there, sorry for the necro. @zimans’s solution (see here) resolved this issue for me; just add 'trusted_proxies' => array('localhost'),
to your config.php. I’m almost positive this will work for you @danb35 because I used your script to setup my Nextcloud jail.
Maybe this has something to do with TrueNAS using vnet to emulate the jail’s network interface? Mine was configured to use this by default.