Redirect back to pi-hole whitelist on blocked domain


#1

Description: When clicking on a blocked domain in a web browser redirect back to pi-hole to login and whitelist.

Many times I will be browsing the Internet and there are certain legitimate sites I would like to get to which are being blocked by pi-hole. I could just log into pi-hole and add to whitelist, but it would be nice if pi-hole could help with that.

I prototyped some code to support this:

  1. I added to list.php the following modification to accept get requests:

    <!-- Domain Input -->
    <div class="form-group input-group">
    <!-- PGMOD -->
    <input id="domain" type="text" class="form-control" value="<?php echo $_GET['domain']?>" placeholder="Add a domain (example.com or sub.example.com)">
    <!-- PGMOD -->
    
  2. I am using apache and added this to the configuration within virtual host section

     RewriteEngine on
     RewriteCond %{HTTP_HOST} !^pi-hole.mydomain.com
     RewriteRule ^/(.*)$ http://pi-hole.mydomain.com/admin/list.php?l=white&domain%{HTTP_HOST} [L,R=301]
    

This used to work when pi-hole returned the pi-hole server IP for the blocked domains. But now it is returning 0.0.0.0 instead.

So this is a feature request to officially support automatic redirect blocked domain to pi-hole to allow the end user to decide to whitelist or not. Maybe it could even give some more detailed info on the blocked domain.


#2

This is already implemented in the block page, which is active when using an IP-based blocking mode: https://docs.pi-hole.net/ftldns/blockingmode/


#3