iFargle / headscale-webui

A simple Headscale web UI for small-scale deployments.
Other
635 stars 60 forks source link

Traefik has a error entryPoint "web-secure" doesn't exist #11

Closed canghai908 closed 1 year ago

canghai908 commented 1 year ago

I use trafik but cann't work ok image my docker-compose file is

version: "3"
services:
  headscale-webui:
    image: ghcr.io/ifargle/headscale-webui:latest
    container_name: headscale-webui
    ports:
      - "5000:5000"
    environment:
      - TZ=UTC                                 # Timezone
      - HS_SERVER=http://222.110.122.115:8080                 # Set this to your Headscale server's URL.  It will need to access /api/ on Headscale.
      - BASE_PATH="/admin"                     # Default, can be anything you want.  Tailscale's Windows app expects "HS_SERVER/admin"
      - KEY="4E3jPM9UUw0tvriFjBAKUfwM9yhh7D8GcttnfFR1KlM="             # Generate with "openssl rand -base64 32"
    volumes:
      - ./volume:/data                         # Headscale-WebUI's storage
      - ./headscale/config/:/etc/headscale/:ro # Headscale's config storage location.  Used to read your Headscale config.
    labels:
      # Traefik Configs
      - "traefik.enable=true"
      - "traefik.http.routers.headscale-webui.entrypoints=web-secure"
      - "traefik.http.routers.headscale-webui.rule=Host(`headscale.opst.net`) && (PathPrefix(`/admin/`) || PathPrefix(`/admin`))"
      - "traefik.http.services.headscale-webui.loadbalancer.server.port=5000"
      - "traefik.http.routers.headscale-webui.tls.certresolver=letsencrypt"
        # redirect /admin to /
      - "traefik.http.middlewares.headscale-webui-stripprefix.stripprefix.forceslash=true"
      - "traefik.http.middlewares.headscale-webui-stripprefix.stripprefix.prefixes=/admin/

I use http://headscale.opst.net is 404

iFargle commented 1 year ago

If you're hosting on http, you'll need to change the config a bit:

      - "traefik.http.routers.headscale-webui.entrypoints=web-secure"  

      - "traefik.http.routers.headscale-webui.tls.certresolver=letsencrypt"

Remove the certresolver line and change the entrypoint to match your HTTP entrypoint name in your Traefik config. Let me know if that works :)

iFargle commented 1 year ago

Second: Are you going to http://headscale.opst.net/admin or just http://headscale.opst.net?

canghai908 commented 1 year ago

I remove the certresolver line and change the entrypoint to match my http. I use http://headscale.opst.net/admin can 308 to http://headscale.opst.net/admin/settings but it 404 not found image I use curl

*   Trying 222.112.55.23:80...
* Connected to headscale.opst.net (222.112.55.23) port 80 (#0)
GET /admin HTTP/1.1
Host: headscale.opst.net
User-Agent: curl/7.74.0
Accept: */*

* Mark bundle as not supporting multiuse
< HTTP/1.1 308 Permanent Redirect
< Content-Length: 261
< Content-Type: text/html; charset=utf-8
< Date: Sun, 12 Feb 2023 03:37:26 GMT
< Location: http://headscale.opst.net/admin/
< Server: gunicorn
<
* Ignoring the response-body
* Connection #0 to host headscale.opst.net left intact
* Issue another request to this URL: 'http://headscale.opst.net/admin/'
* Found bundle for host headscale.opst.net: 0x55fd81d179d0 [serially]
* Can not multiplex, even if we wanted to!
* Re-using existing connection! (#0) with host headscale.opst.net
* Connected to headscale.opst.net (222.112.55.23) port 80 (#0)
GET /admin/ HTTP/1.1
Host: headscale.opst.net
User-Agent: curl/7.74.0
Accept: */*

* Mark bundle as not supporting multiuse
< HTTP/1.1 302 Found
< Content-Length: 217
< Content-Type: text/html; charset=utf-8
< Date: Sun, 12 Feb 2023 03:37:26 GMT
< Location: /admin/settings
< Server: gunicorn
<
* Ignoring the response-body
* Connection #0 to host headscale.opst.net left intact
* Issue another request to this URL: 'http://headscale.opst.net/admin/settings'
* Found bundle for host headscale.opst.net: 0x55fd81d179d0 [serially]
* Can not multiplex, even if we wanted to!
* Re-using existing connection! (#0) with host headscale.opst.net
* Connected to headscale.opst.net (222.112.55.23) port 80 (#0)
GET /admin/settings HTTP/1.1
Host: headscale.opst.net
User-Agent: curl/7.74.0
Accept: */*

* Mark bundle as not supporting multiuse
< HTTP/1.1 404 Not Found
< Content-Length: 207
< Content-Type: text/html; charset=utf-8
< Date: Sun, 12 Feb 2023 03:37:26 GMT
< Server: gunicorn
<
<!doctype html>
<html lang=en>
<title>404 Not Found</title>
<h1>Not Found</h1>
<p>The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.</p>
* Connection #0 to host headscale.opst.net left intact
iFargle commented 1 year ago

You might also need this line for your labels as well:

      - 'traefik.http.routers.headscale-webui.middlewares=headscale-webui-stripprefix@docker'

I'll work on making this more friendly. Let me know if this works

canghai908 commented 1 year ago

You might also need this line for your labels as well:

      - 'traefik.http.routers.headscale-webui.middlewares=headscale-webui-stripprefix@docker'

I'll work on making this more friendly. Let me know if this works

Thank you! It works

iFargle commented 1 year ago

👍