Display Pi-hole via iFrame in Home Assistant

Hello. With my very basic unix skills i'm trying to display Pi-hole via an iFrame in Home Assistant. When i add code to do this and click the tab in Home Assistant (HA), i get "[ERROR]: Unable to parse results from queryads.php: Unhandled error message ()" shown in HA.

What i understood is that the code that prevents using iFrame is ""X-Frame-Options" => "DENY"" in /etc/lighttpd/lighttpd.conf (https://www.reddit.com/r/pihole/comments/6ock0s/cant_get_the_pihole_dashboard_to_display_in_an/).

Since that file gets overwitten when pi-hole is updated (?), i read i should put some code in external.conf. I've now created that file with the following code

"
setenv.add-response-header = (
"X-Pi-hole" => "The Pi-hole Web interface is working!",
"X-Frame-Options" => "ALLOW"
)

"
But still get the error.

See here for the lighttpd docs: Docs ModSetEnv - Lighttpd - lighty labs

You probably have to use the setenv.set-* version of the command.

Thank you. Changed add to set. The page with the iframe still reports

x Uncaught (in promise) DOMException: Only secure origins are allowed (see: https://goo.gl/Y0ZkNV).
3 pihole:1 Refused to display 'http://192.168.1.134:8093/admin/' in a frame because it set 'X-Frame-Options' to 'deny'.

So my attempt to override in external.conf doesn't seem to work yet. I'll keep on digging.

For now i've decided to edit /etc/lighttpd/lighttpd.conf and change DENY to ALLOW. This works

2 Likes

Anything else you changed? I changed this and then rebooted but still getting the white page in HA. Thanks

1 Like

I tested it yesterday also and it didn't work for me neither with Web Interface 5.5

Fixed: the path was incorrect. It should be:

-/my-external.conf:/etc/lighttpd/external.conf

Don't execute commands or edit files inside the running docker container. Any edits you make will very likely not persist across container starts or image updates.

We don't allow alt accounts here. I'll delete this one and you can use your first one.

But still tho HOW DO YOU DO THIS ON DOCKER?!

I DON'T KNOW!!!

1 Like

I've managed to get my PiHole login page displaying in an iFrame (removed the X-Frame-Options header in nginx) but I am not able to log in. Entering a password just keeps sending me back to the login page. Everything works fine outside of the iFrame. Any ideas?