From 42ee02d8e746f5528f9dbefa02ebaca1e4347e74 Mon Sep 17 00:00:00 2001 From: aki Date: Fri, 25 Apr 2025 13:07:53 +0800 Subject: [PATCH] fix(homepage): Update allowed hosts and add basic auth middleware configuration --- docker-compose.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 155028b..632d132 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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