Issue with Assets field and XHR request returning 401 Unauthorised

hey guys, i have an issue with the Assets field when selecting media (only on prod and staging, works fine on local dev env). The assets manager section works fine in all environments, i can upload images, move them around.

But once I try to select any images via Assets field, inside a collection item for example, it will return 401 Unauthorised. I tried discord to get some help but nothing seems to work.

The hosting setup is Nginx as SSL termination and proxy to a Varnish cache at the front of it. I added protected $proxies = '*'; to trustproxies middleware. Added Access-Control-Allow-Origin: * as well. I also return(pass); in vcl_recv when logged in to control panel. But it still doesn't work. I enabled debug and what seems to happen when I select an image, it throws the below exception, and subsequently logs me out.

Unauthenticated. /var/www/staging.xxx.com/content/vendor/statamic/cms/src/Http/Middleware/CP/Authorize.php#17 Statamic\Exceptions\AuthenticationException

$user = User::current(); if (! $user) { throw new AuthenticationException('Unauthenticated.'); } if ($user->cant('access cp')) {

Any help would be much appreciated.

Cheers, Mark

>>>>>>> Unanswered <<<<<<<
1 Reply
2 Followers