fix(homepage): Update allowed hosts and add basic auth middleware configuration

This commit is contained in:
Jose Daniel G. Percy 2025-04-25 13:07:53 +08:00
parent 83016e268c
commit 42ee02d8e7

View File

@ -467,7 +467,11 @@ services:
- HOMEPAGE_VAR_WEATHER_LONG=${HOMEPAGE_VAR_WEATHER_LONG}
- HOMEPAGE_VAR_WEATHER_TIME=${TIMEZONE}
- HOMEPAGE_VAR_WEATHER_UNIT=${HOMEPAGE_VAR_WEATHER_UNIT}
- HOMEPAGE_ALLOWED_HOSTS=${HOSTNAME}
# Allow access from localhost, the service name, and the primary HOSTNAME
- HOMEPAGE_ALLOWED_HOSTS=localhost,homepage,${HOSTNAME}
# Pass auth user/hash if set (optional, for potential future use by homepage itself, though Traefik handles it)
- HOMEPAGE_AUTH_USER=${HOMEPAGE_AUTH_USER}
- HOMEPAGE_AUTH_HASH=${HOMEPAGE_AUTH_HASH}
volumes:
- ${CONFIG_ROOT:-.}/homepage:/app/config:Z
- /var/run/docker.sock:/var/run/docker.sock:ro
@ -479,6 +483,10 @@ services:
- traefik.enable=true
- traefik.http.routers.homepage.rule=PathPrefix(`/`)
- traefik.http.routers.homepage.entrypoints=web
# Define Basic Auth Middleware (only active if HOMEPAGE_AUTH_HASH is set in .env)
- traefik.http.middlewares.homepage-auth.basicAuth.users=${HOMEPAGE_AUTH_HASH}
# Apply Middleware to Router
- traefik.http.routers.homepage.middlewares=homepage-auth@docker
- traefik.http.services.homepage.loadbalancer.server.port=3000
watchtower:
image: ghcr.io/containrrr/watchtower:latest