Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to connect to the local headscale-ui, there is a problem with the APIKEY #97

Closed
MilkTeaNo7 opened this issue Feb 3, 2023 · 4 comments
Labels
question Further information is requested

Comments

@MilkTeaNo7
Copy link

** Supporting Details **
Provide the following:

  • Browser Version:Chrome 109.0.5414.120
  • Headscale Version: 2022.12.23.2-beta...2023.01.30-beta
  • Any Browser Errors (control+shift+i in chrome to see)
    TypeError: Failed to fetch

I did not use the installation method of docker composer to install
I downloaded the latest version of headscale-ui and uploaded it to the server directory
Then achieve the effect of accessing the headscale-ui setting page through Nginx
But when visiting the home page, he will prompt: TypeError: Failed to fetch

Then I enter the APIKEY on the setting page, but I still can't connect successfully
Through the network module of F12, it is found that the request address of many of its contents is 127.0.0.1:7890
But the port 7890 is not monitored locally, the actual port should be 6060
Can't find where to change this setting

i don't know what to do

image

`#HeadscaleUI
server {
#listen 80;
listen 443 ssl;
server_name vpn.baidu.top;

ssl_certificate /etc/nginx/SSL/fullchain.crt;
ssl_certificate_key /etc/nginx/SSL/privkey.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_prefer_server_ciphers on;
ssl_session_timeout 5m;
keepalive_timeout 70;

location /web {
    alias /etc/headscale/web;
    try_files $uri $uri/ /index.html;
}

location / {
    proxy_redirect off;
    proxy_pass http://127.0.0.1:6060; # port
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

}

}`

@routerino
Copy link
Contributor

routerino commented Feb 4, 2023

you're connecting on 6060 and on http. 6060 is not a standard https port. Are you sure CORS is configured correctly? If you're using a reverse proxy there is no reason to connect on port 6060.

@routerino routerino added the question Further information is requested label Feb 4, 2023
@MilkTeaNo7
Copy link
Author

您正在连接 6060 和 http。6060 不是标准的 https 端口。您确定 CORS 配置正确吗?如果您使用的是反向代理,则没有理由连接到端口 6060。

  1. I need to organize my thoughts and update my new findings
  2. At present, open the settings page of headscale-ui, if you only enter the Headscale API Key, but do not enter the Headscale URL, and then click SaveAPI, it will indicate that the connection is successful, if you enter the Headscale URL, the connection will fail,it's a little weird

For the Headscale server, I did not use a reverse proxy. Currently, I use the domain name + port to access, such as https://google.com:6060/windows, which can be accessed normally.
For my current problem, does it have to be achieved using a reverse proxy, something like this? vpn.google.com? ?

Thank you for your help

@routerino
Copy link
Contributor

您正在连接 6060 和 http。6060 不是标准的 https 端口。您确定 CORS 配置正确吗?如果您使用的是反向代理,则没有理由连接到端口 6060。

  1. I need to organize my thoughts and update my new findings
  2. At present, open the settings page of headscale-ui, if you only enter the Headscale API Key, but do not enter the Headscale URL, and then click SaveAPI, it will indicate that the connection is successful, if you enter the Headscale URL, the connection will fail,it's a little weird

For the Headscale server, I did not use a reverse proxy. Currently, I use the domain name + port to access, such as https://google.com:6060/windows, which can be accessed normally. For my current problem, does it have to be achieved using a reverse proxy, something like this? vpn.google.com? ?

Thank you for your help

from the front page:

Errors related to "Missing Bearer Prefix"
Your API key is not saved. Create an API key in headscale (via command line) with headscale apikeys create or docker exec headscale apikeys create and save it in settings.

Alternatively, you haven't fixed your domain. HS-UI has to be ran on the same subdomain or you need to configure CORS. Yes you need to use a reverse proxy to do this. Use a reverse proxy.

@routerino
Copy link
Contributor

closing as question has been answered

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants