GoodiesHQ/headscale-admin

Problem with connecting to headscale server

Closed this issue · 2 comments

I'm trying to connect local instalation of Headscale-Admin (docker goodieshq/headscale-admin:dev and goodieshq/headscale-admin:latest) to my instalation of Headscale v0.23.0-alpha12. I got in headscale log:

headscale headscale[53309]: 2024-06-16T18:59:37Z ERR ../../../home/runner/work/headscale/headscale/hscontrol/app.go:396 > missing "Bearer " prefix in "Authorization" header client_address=xxxxxxxxxxxxxxx:xxxxx

When i check using curl, i've got the same problem

curl -H "Authorization: APIKEY" https://headscale.xxxxxx/api/v1/node
Unauthorized

until I try:
curl -H "Authorization: Bearer APIKEY" https://headscale.xxxxxx/api/v1/node
{"nodes":[{"id":"4","machineKey":"m .........................................

That's very odd behavior.

This is the current release. The only time the headers are explicitly defined is in the src/lib/common/api/base.ts headers() function where it clearly shows "Bearer " prefix. How about in the developer console network tab? Are you able to see the headers of requests its sending out?

function headers(): { headers: HeadersInit } {
if (typeof window === 'undefined') {
return { headers: {} };
}
return {
headers: {
Authorization: 'Bearer ' + get(ApiKeyStore),
Accept: 'application/json',
},
};
}

I'm also experiencing this problem. I am trying to set up this admin UI for the first time, but I immediately encountered this issue. Not sure how to go about debugging, but I'm happy to provide any information you need.

Headscale is running in a container, and the instance is behind an NGINX reverse proxy.

I'm experiencing this in Firefox and Safari.

EDIT:
spoke too soon. I think this is a CORs issue. Setting up the Admin page under the same subdomain as the headscale server works :)