The issue I am facing:
Kept on getting CORS errors from my keepalived VIP.
When manually adding that IP to the $AUTHORIZED_HOSTNAMES array in auth.php, it works fine - no issues.
When setting that IP as a variable in /etc/environment, CORS errors get thrown.
I'm trying to get the PiHole type in homer to work with the PiHole's API, but it only works when I manually add the Virtual IP manually in the auth.php file.
Tried adding the "add_header 'Access-Control-Allow-Origin' '*';"-line that I see on almost every other forum, but had no luck. The errors do go away, but no status is being displayed on the homer dashboard.
Details about my system:
Raspberry Pi 5, running nginx, homer, pihole, pivpn, keepalived.
What I have changed since installing Pi-hole:
I'm not using lighttpd as a web server, only nginx.
I've moved the web directory from its usual www-data directory and into /usr/share/nginx/pihole.
PiHole works as it should, and I have no problems with its setup or functionality, only this CORS error that keeps bugging me.
I've set custom ports for every service.
Nothing is run in docker, everything is "bare-metal" as it were.
Not well versed in network applications or the settings that run them, just toying around and learning while winging it
VIRTUAL_HOST is an environment variable used only in Docker Pi-hole:
Variable
Default
Value
Description
VIRTUAL_HOST
${HOSTNAME}
<Custom Hostname>
What your web server 'virtual host' is, accessing admin through this Hostname/IP allows you to make changes to the whitelist / blacklists in addition to the default 'http://pi.hole/admin/' address
Also, this variable must be set inside PHP environment to be used in the web interface.
Docker Pi-hole has code to add the variable value into lighttpd configuration:
But in bare metal installations we don't use this variable.
If you want to use the variable inside PHP environment using a different web server (nginx) you need to configure the variable using nginx config files.