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

Allow custom web interface URI for Pi-hole admin #1739

Closed
wants to merge 2 commits into from

Conversation

pepramon
Copy link

Overview

This pull request adds support for a configurable web interface URI in the Pi-hole Docker container. With this update, users can specify where the Pi-hole admin interface is served by setting the environment variable FTLCONF_webserver_paths_webhome.

Motivation

In many deployment scenarios—especially those using a reverse proxy for HTTPS—it is beneficial to serve the admin interface under a custom URI. For example, by setting FTLCONF_webserver_paths_webhome=/pihole/ in your docker-compose file, the admin interface will be available at /pihole/ instead of the default /admin/.

How to Enable

To activate this feature, add the following line to your docker-compose file:

FTLCONF_webserver_paths_webhome=/pihole/

This instructs the container to serve the admin interface from the specified path.

Testing

Please test the change in your environment by defining the variable and verifying that the Pi-hole admin interface is correctly accessible from the new URI.

Conclusion

This update provides enhanced flexibility for configuring the Pi-hole Docker container, making it easier to integrate with custom routing or proxy setups.

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]>
@yubiuser
Copy link
Member

This might work in docker already, but on bare metal this won't work as we (unfortunately) have some hard-coded paths in various scripts.

@rdwebdesign
Copy link
Member

rdwebdesign commented Feb 23, 2025

I don't think this will work in docker without other modifications.

I think the pihole updatechecker function (used to search for updates) uses the hard-coded path for git commands.

@pepramon
Copy link
Author

I tested it and it works for a Docker image without problems.

You can enter the container using docker exec -it pihole /bin/bash and try moving the path. This approach does not work and the web interface loads incorrectly; you need to change FTLCONF_webserver_paths_webhome for it to work correctly.

I do not know how pihole updatechecker works, but in a Docker approach, I do not update via Git or script; I just update the image, and that's all. However, if you use pihole updatechecker before moving the path, it will probably work correctly because when the Docker image starts, the main path is /admin/ and you move it after the update is done.

I do not know how updatechecker works or when it is triggered, and I have tried to review those aspects.

@rdwebdesign
Copy link
Member

I do not know how pihole updatechecker works

It uses git to compare the local and remote branches.

These lines won't work if the web interface is moved:

https://github.com/pi-hole/pi-hole/blob/567bb724b18bf174f033d0b8b289cc44a5e9c8eb/advanced/Scripts/updatecheck.sh#L88-L95

Without updatechecker, the container will fail to find the current local version.

@pepramon
Copy link
Author

I just added a little dirty trick:

Just add a symlink to the admin directory so that other scripts can work properly. However, it is necessary to set FTLCONF_webserver_paths_webhome because if it is not set, the admin page does not work properly.

@rdwebdesign
Copy link
Member

I really think this should be fixed on Core as well before any release, so every installation (docker and bare metal) will allow this option.

And when we change Core code, some changes made here will need to be adjusted, some will be unnecessary.

@PromoFaux
Copy link
Member

No comment on inclusion validity at the moment, but from a technical standpoint:

The login page goes brrrrrrrrrrrrrrrrrrrrrrr. Which it probably shouldn't 😉

loginpagebrrrr

@rdwebdesign
Copy link
Member

Looks like the page is redirecting to itself (/admin/login) or constantly reloading.

@PromoFaux
Copy link
Member

I really think this should be fixed on Core as well before any release,

There are also some hardcoded admin/ paths in the web interface by the looks of things

image

@rdwebdesign
Copy link
Member

@pepramon
Copy link
Author

Oups, I do not detect that issue, my pihole is behind a nginx proxy, and seem that happens with SSL fail. Now I see

Later, when you enter (jut try to write and stops), seems that all works nice. It's only the login page.

I think that better option is remove this pull request because is harder than I think.

Sorry.

@pepramon pepramon closed this Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants