I am using PiHole API with another service. To use it I need to access the API with a specific URL, where PiHole returns me that there are problems with CORS. [I have no idea what Cors is or how it works].
However, if I add the domain I want to access the API from here, everything works fine: var/www/html/pihole/scripts/pihole/php/auth.php
...
function check_cors()
{
$ip = $_SERVER['SERVER_ADDR'];
// Check CORS
$AUTHORIZED_HOSTNAMES = array(
$ip,
str_replace(array('[', ']'), array('', ''), $_SERVER['SERVER_NAME']),
'pi.hole',
'localhost',
'HERE MY DOMAIN',
);
...
Unfortunately this resets after every update. Could you make it possible to enter a domain there permanently, so that I don't have to re-enter it after each update?
If you'd read that code further, you should see that you could populate CORS_HOSTS (and also VIRTUAL_HOST, potentially) environment variables for that purpose.