How to enable remote internet access for pi-hole web dashboard

dashboard

#1

If, after reading https://pi-hole.net/2016/09/15/tips-for-accessing-your-pi-hole-remotely/ warnings about open ports for accessing your pi-hole dashboard remotely, you still wanna do it here’s how I did it.
I’m posting this ‘guide’ because I couldn’t find one on this forum nor googling. Sorry if I missed it :crazy_face:

  1. Forward port 80 to pi-hole IP on your router (you can also forward 22 port for SSH).
  2. If you have a dynamic IP you’ll need a dyn. ip service like no-ip.com, it has free and paid services, depending on the domain address you select. This can be set on the majority of actual routers.
  3. Add to file /var/www/html/admin/scripts/pi-hole/php/auth.php the domain you choose (mydomain.com in this example):
    // Check CORS
    $AUTHORIZED_HOSTNAMES = array(
    $ipv4,
    $ipv6,
    str_replace(array("[","]"), array("",""), $_SERVER["SERVER_NAME"]),
    "pi.hole",
    "localhost",
    "mydomain.com"
    );
  4. You don’t need to restart the pi-hole, just enter the domain on your browser and that’s all!