The issue I am facing:
I run Pi-Hole on a raspberry pi and everything was working well until I updated to V6 today. I can reach the log in on the admin page but when I put my password in I get the following error:
Bad request
The API is hosted at pi.hole/api, not pi.hole/admin/api
And I am unable to log in. When I reach my Pi-Hole by IP address everything works as expected.
Details about my system:
Pi-Hole is running on a Raspberry Pi 4B. I am running Pi-Hole with Unbound. Pi-Hole's admin page is not exposed to the internet but I am using local DNS records to point to a proxy server (NPMPlus). This Pi-Hole instance is addressable at https://pihole1.domain.com.
When bypassing the proxy and go directly to the IP Address/admin I am able to log in as expected.
In NPMPlus I use the following custom NGINX configuration:
# Pihole /admin/ Fix
location / {
proxy_pass http://10.0.50.50:80/admin/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_hide_header X-Frame-Options;
proxy_set_header X-Frame-Options "SAMEORIGIN";
}
I have uploaded the debug log : https://tricorder.pi-hole.net/nwyaM0XU/
What I have changed since installing Pi-hole:
Updated using pihole -up to v6.
I understand that there was API changes, does anyone have any guidance on my custom configuration and how to get API calls to the appropriate place?
Hey, thanks for the quick reply. I'm not an expert at this, I didn't write the first custom entry myself, it was something that I found and made work in my specific situation.
I read through your linked post
I changed my NGINX entry to what was recommended in your linked post.
server {
listen 10.0.50.50:80;
listen [::]:80 ;
server_name pihole1.domain.com;
location / {
return 301 $scheme://$host/admin/;
}
location /admin/ {
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:8001/admin/;
}
location /api/ {
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:8001/api/;
}
}
server {
# redirect non-standard TLD to proper domain
listen 10.0.50.50:80;
listen [::]:80 ;
server_name pihole1;
location / {
return 301 $scheme://pihole1.domain.com/admin/;
}
}
This actually just sends me off to the webpage at domain.com while still showing pihole1.domain.com and doesn't send the browser to the pihole admin page.
I continued reading through the other replies in that post and found that settings for being behind proxy servers were added. So I went through the Pi-Hole settings and found that I don't even need a custom configuration any longer to make it work behind NPMPlus. So I deleted the entire thing and it's working perfect now.
Thank You for your time!
I can say the same.I don't use nginx
or NPMPlus.
You can search on nginx
forums or wait for suggestions from other users.
Actually I found that the solution wasn't a change in the custom configuration, but to omit it outright with v6 and use the settings inside pihole for use behind a proxy manager.
But, I appreciate your time nonetheless.