Skip to content

Commit

Permalink
Allow custom web interface URI for Pi-hole admin
Browse files Browse the repository at this point in the history
This change introduces the ability to customize the URI
from which the Pi-hole admin interface is served. Previously,
the webroot was hardcoded as "/admin/". Now, if the configuration
variable FTLCONF_webserver_paths_webhome is defined
(e.g., FTLCONF_webserver_paths_webhome=/pihole/), the interface
will be served from that specified path.

This update enhances flexibility for deployments that use a reverse proxy
to handle HTTPS and route traffic to the correct container path.

Signed-off-by: pepramon <[email protected]>
  • Loading branch information
pepramon committed Feb 22, 2025
1 parent 29b604a commit cc0263b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/bash_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,19 @@ ftl_config() {
echo " [i] No DNS upstream set in environment or config file, defaulting to Google DNS"
setFTLConfigValue "dns.upstreams" "[\"8.8.8.8\", \"8.8.4.4\"]"
fi

# If the function getFTLConfigValue("webserver.paths.webhome") returns a value different from "/admin/",
# Then, move the directory "/var/www/html/admin" to the new location.
if WEBHOME=$(getFTLConfigValue "webserver.paths.webhome") && [[ "$WEBHOME" != "/admin/" ]]; then
# Remove leading slash if present
WEBHOME="${WEBHOME#/}"

# Move the existing admin directory to the new location
if [ -d "/var/www/html/admin" ]; then
echo "Moving /var/www/html/admin to /var/www/html/$WEBHOME"
mv /var/www/html/admin "/var/www/html/$WEBHOME"
fi
fi

setup_web_password
}
Expand Down

0 comments on commit cc0263b

Please sign in to comment.