Spice UI - Error Authenticating/Login Unauthorized 401

I am having problems logging in via SpiceUI. I can only access if I have a logged in session in the backend.

The console error I see at UI login is:
GET https://spiceui/backend/KREST/login 401 (Unauthorized)

This is despite entering the correct login details, the UI error displayed is ‘error authenticating, wrong username or password’

Any ideas what causes this?

Jake.

How did you set proxy during UI install? true or false?
Is your https certificate valid?
Logout from backend.
Delete Browser local storage: F12 dev tools > Application > Local Storage + Session Storage + Cookies
Re-try

Proxy set to false.
Yes certificate is valid in the browser
Followed those instructions and no change.

I do get an error related to proxy in the console:
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
url - ‘/proxy/?useurl=’

Let’s check what was stored in spiceui/config/sites/000.conf (might be another name if you entered another one during ui install)
Content is a json string your find your proxy settings: “proxy”:false
If you find true then edit to false

I also checked here too a number of times and I’ll be honest, reverted between true and false while clearing cache etc this didn’t change anything.

It is definitely set to false at present and has been for some time.

Regards, Jake.

ok.
I have the problem sometimes but I am not able to reproduce systematically. It seems to be related to multiple open UI instances.
But since you deleted browser storage and cookies, there is no way it would be the cause.
I unfortunately have no clue for now.

I believe the proxy error is resolved by putting:

if (!function_exists('getallheaders')) 
{ 
    function getallheaders() 
    { 
       $headers = array (); 
       foreach ($_SERVER as $name => $value) 
       { 
           if (substr($name, 0, 5) == 'HTTP_') 
           { 
               $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value; 
           } 
       } 
       return $headers; 
    } 
} 

in spiceui/proxy/proxy.php

Still looking for the authorisation error cause though as I am not able to login via UI.

You should put the code in KREST/index.php
So that the function exists before proxy is checked.
Right at the top should do.

Thanks for your reply.

This is where I have it, I didn’t see that proxy is called in this file but I have had it in the head of KREST/index.php since seeing the fix in the other post.