Blocked domain redirection to custom domain

Is it possible to configure pi-hole to redirect all blocked domain requests to a certain custom domain i.e "aaaa.com" ? Thanks.

You can configure the IP address that it resolves blocked domains to, but there is not mechanism in place to tell the user's browser to change domains.

Thanks. The background of my question is the following problem:

  1. Browser attempts to display blocked content from https://ad.blockeddomain.com in a website
  2. Pihole blocks by redirecting the request to https://PI_HOLE_IP:80 ?
  3. Nginx listening on port 443 in the same machine as pihole redirects to a server runnning on port XXXX
  4. Server provides ssl certificate to browser
  5. Browser displays a warning popup due to wrong domain certificate

To avoide the above popup, I am thinking of redirecting all pihole blocked domains to a certain IP, which will be intercepted by nginx and then redirected back to http://PI_HOLE_IP:80. Do you think this is feasible?

Just stumbled upon this, could work for me:

Most any software thats using network can be configured to bind/listen to a particular socket (IP + port#).
You can have as many web daemons running as you like, listening on the same ports (default=80+443), by just adding more IP addresses to the host :wink:

Just did the following and seemed to work:

Added a new virtual interface in /etc/network/interfaces:

auto eth0.0
iface eth0.0 inet manual

Assigned a static IP to this new interface in /etc/dhcpcd.conf:

denyinterfaces eth0
interface eth0.0
static ip_address=192.168.1.201/24 

Rebooted raspberry pi so that interface changes take effect.

Modified /etc/lighttpd/external.conf to modify bind address:

server.bind = "192.168.1.201"

Run pihole -r and reconfigured pihole to use the new virtual interface eth0.0 and use 192.168.1.201 as static ip.

1 Like

Although Blocked domain redirection to custom domain - #6 by trimethia prevented me from seeing popups, I also needed to change my nginx reverse proxy configuration to only listen to the original IP address of my ip 192.168.1.200. This is done to avoid listening (and processing) https requests coming from 192.168.1.201.

One more thing, for the lighttpd blocking page to work I also had to change the hardcoded IP in /var/www/html/pihole/index.php with my new local IP address.

Related issue: Block page failure - queryads.php: Connection timeout · Issue #2172 · pi-hole/pi-hole · GitHub

Nice you got it to work with dhcpcd5 ... I at the time was not able to and dont know why :wink:

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.