i have pihole installed on a different machine, so pi hole do not run as a docker container next to Traefik.
What i have done is, that i added pihole as an external router to my config.yml.
If i access the URL via my browser, i can see the start page of pihole, but after fill in my admin credentials,
the site will always redirect to /admin
Why do you have this? Messing with paths for a full-blown application usually does not work. Apps are mostly not path-aware and will redirect or link to fixed paths, which then don’t work anymore.
Best practice for multiple services on the same (reverse proxy) server is to use sub-domains.
I use the subdomain pihole.local.localdomain.... For each Service behind Traefik an own local subdomain. That just works fine for all my Services, execp pihole, because if i will open the sudomain for pihole and enter my credentials, pihole will redirect me to /admin, which does not exist. So i want to redirect back to the subdomain of pihole. But that isn't working....
I had the same issue yesterday. The redirects don't get updated and pihole redirects you to the wrong pages constantly.
If you're willing to have /admin put in the URL automatically you can also just use the following middleware to redirect from the root to /admin automatically
The only thing is now, that always the path /admin is there.
It is ok for me..... But is there no way to work only with the base URL, without the addition of
the path /admin in the URL...?
I was wondering if anything has changed with version 3. I recently started using Traefik and I used this exact configuration for my PiHole. The initial redirect to the https://nn.acb.xyz/admin works fine but as soon as I login I get the following:
Failed Host Check: nn.acb.xyz vs 192.168.10.07, pihole, pi.hole, localhost
I kept getting 307 redirections in a loop to the same address because I had put the redirectRegex middleware before the addPrefix !
By the way, when you need to log back in after a period of inactivity, you will be redirected to a /admin/dns_records.php for example. This page does not exist as the /admin is supposed to be removed and the proposed solutions above do not help when there is anything after it.
So here is my regex solution:
Regex explanations: The ${1} and ${2} in the replace correspond respectively to the first and second capturing groups (in parentheses). For the first it can only match the host part with word characters (double escape for yaml), dots and minus signs while the second matches anything that may follow /admin. The first question mark matches http and https.
PS: If you truly need to support http, create a capture group http(s?) in the regex and the replacement string should look like this "http${1}://${2}${3}"
Hello. I am testing traefik since I wanted to convert over from NPM. Trying to get pihole redirect to work but am getting the 403 error page using your code.
This is what I’ve added . It think my formatting is correct.
Enable and check Traefik debug log (doc), any "ERR" in logs? Enable and check Traefik access log in JSON format (doc), what’s the output during requests?
2025-09-15T02:53:12Z WRN Could not find network named "traefik" for container "/error-pages1". Maybe you're missing the project's prefix in the label? container=error-pages-traefik-4d2066146e4d47411888a47952b414fb48ea16fd809a78df3c83efd44aaef2f0 providerName=docker serviceName=error-pages
2025-09-15T02:53:12Z WRN Defaulting to first available network (&{"proxy" "172.20.0.2" '\x00' "" "b50985db2e459abcc997c6585ec19ba906aeb237fae3e06125908e46ec7d8cf4"}) for container "/error-pages1". container=error-pages-traefik-4d2066146e4d47411888a47952b414fb48ea16fd809a78df3c83efd44aaef2f0 providerName=docker serviceName=error-pages
2025-09-15T03:45:21Z ERR Error occurred during watcher callback error="yaml: unmarshal errors:\n line 54: mapping key \"service\" already defined at line 47\n line 53: mapping key \"tls\" already defined at line 48" providerName=file
2025-09-15T03:46:17Z ERR Error occurred during watcher callback error="yaml: unmarshal errors:\n line 54: mapping key \"service\" already defined at line 47\n line 53: mapping key \"tls\" already defined at line 48" providerName=file
2025-09-15T03:47:18Z ERR Error occurred during watcher callback error="yaml: unmarshal errors:\n line 53: mapping key \"tls\" already defined at line 48" providerName=file
2025-09-15T03:47:34Z ERR EntryPoint doesn't exist entryPointName=websecure routerName=pihole@file
2025-09-15T03:47:34Z ERR No valid entryPoint for this router routerName=pihole@file
2025-09-15T03:47:34Z ERR EntryPoint doesn't exist entryPointName=websecure routerName=pihole@file
2025-09-15T03:47:34Z ERR No valid entryPoint for this router routerName=pihole@file
2025-09-15T03:47:34Z ERR Router uses a nonexistent certificate resolver certificateResolver=le routerName=pihole@file
2025-09-15T03:47:53Z ERR EntryPoint doesn't exist entryPointName=websecure routerName=pihole@file
2025-09-15T03:47:53Z ERR No valid entryPoint for this router routerName=pihole@file
2025-09-15T03:47:53Z ERR EntryPoint doesn't exist entryPointName=websecure routerName=pihole@file
2025-09-15T03:47:53Z ERR No valid entryPoint for this router routerName=pihole@file
2025-09-15T03:47:53Z ERR Router uses a nonexistent certificate resolver certificateResolver=le routerName=pihole@file
2025-09-15T03:49:01Z ERR EntryPoint doesn't exist entryPointName=websecure routerName=pihole@file
2025-09-15T03:49:01Z ERR No valid entryPoint for this router routerName=pihole@file
2025-09-15T03:49:01Z ERR EntryPoint doesn't exist entryPointName=websecure routerName=pihole@file
2025-09-15T03:49:01Z ERR No valid entryPoint for this router routerName=pihole@file
2025-09-15T03:50:20Z ERR EntryPoint doesn't exist entryPointName=websecure routerName=pihole@file
2025-09-15T03:50:20Z ERR No valid entryPoint for this router routerName=pihole@file
2025-09-15T04:02:23Z ERR Error occurred during watcher callback error="field not found, node: redirect" providerName=file
2025-09-15T04:08:03Z ERR error="middleware \"pihole-prefix@file\" does not exist" entryPointName=https routerName=pihole@file
2025-09-15T04:51:46Z ERR Error occurred during watcher callback error="yaml: unmarshal errors:\n line 25: mapping key \"https-redirectscheme\" already defined at line 16" providerName=file
2025-09-15T07:46:50Z INF I have to go...
2025-09-15T07:46:50Z INF Stopping server gracefully
2025-09-15T07:46:51Z INF Server stopped
2025-09-15T07:46:51Z INF Shutting down
Pihole is working. It is the redirect of omitting the /admin that is not. Wonder why it is working for @ benji and not for all. Pihole is running the latest v6. The errors were me commenting out the middlewares entries.