Hello everyone! I'm using Pi-hole for a while and recently moved my Pi-Hole to a new server, installed OVPN with it and after some trying got pihole working trough the vpn and normally.
However when i "bought" a domain on freenom. I checked if the dns translation was working and noticed that the default page wasn't showing proper.
I just answered a similar question from another user. You're already a step ahead of them because you're hosting a vpn.
Firstly, exposing either port 80, http server or port 53 DNS server, of the Pi-hole to the internet is not recommended. The web ui is sent over http, and vulnerable to data manipulation or capture, and any security flaws in Pi-hole or lightttp could be exploited. Exposing the DNS server (which you haven’t said you’ve done, but just in case) leaves your system open to attack or to serve as part of a DNS amplification attack against another host.
From a technical perspective, the reason the javascript is broken is that your Pi-hole does not expect to be on the domain you have listed - it only expects to be on http://pi.hole, or http://127.0.0.1. So it will not render correctly when trying to access it from an incorrect domain.
Seeing as you are hosting your own VPN, if you want to visit your pi-hole from outside of your own network, you should basically do this instead:
Connect via VPN to your network. Assuming it's all set up properly, you’ll be assignd an IP on your local network, and all traffic will be encrypted.
Visit http://pi.hole as you would from any system on your network.
The web interface only lets you access it from a handful of "safe" domains, including pi.hole, localhost, the device's hostname, and a configurable extra host. You may need to add this new host to the list. However, it would be better if you just use a VPN.
Where exactly can i add this new host? Do you mean the white list or?
@robgill thank you for the extensive answer, i sadly have only one host/vps to run both. I use the vpn only when i'm on my phone using apps that contain ads. So i use it barely
Also yes i can do both of those steps. Connection with my vpn enables me to use http://pi.hole. But because the ip is public, i don't really use it.
Sorry, the few times the virtual host comes up I have to look for where I last explained it to find the config snippet I tested. It's usually better to just use a VPN.
Add this to /etc/lighttpd/external.conf (or create it if it doesn't exist):