Currently I have setup Pihole(v5.12.2) in an Ubuntu 20.04 VPS. I have installed Nginx as a reverse proxy for DNS over TLS and it works fine but in the logs in Pihole everything appears as 127.0.0.1 due to Nginx not forwarding the real IP of the each client.
This is currently my configuration:
upstream dns-servers
{
server 127.0.0.1:53;
}
server {
listen 853 ssl;
ssl_certificate /etc/letsencrypt/live/domainname.here/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/domainname.here/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_handshake_timeout 10s;
ssl_session_cache shared:SSL:20m;
ssl_session_timeout 4h;
proxy_pass dns-servers;
proxy_responses 1;
proxy_timeout 1s;
}
If I try to add a directive for proxy_set_header
or real_ip_header
I get the message directive is not allowed here
. I tried also to use this directive proxy_bind $remote_addr transparent;
and although it is accepted it leads to a timeout in every request being made.
what is the proper way to forward the real IP of a client so it is received correctly by Pihole?