Default website not showing when using domain name

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.

Expected Behaviour:

When i visit http://my.ip.address.here i get the default page as wished.
When i visit http://my-host-name.tld i get a different broken page.

The server only runs OVPN on the same interface.

Actual Behaviour:

I get a different page what seems to be more broken.

Debug Token:

nx98v2o6lk

Thank you for your intrest and i hope the issue isn't to complicated. If any futher info is needed, just ask!

Mod Edit: Replaced IP address and hostname with mocks

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:

  1. 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.

  2. 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 :slight_smile:

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):

setenv.add-environment = ( "VIRTUAL_HOST" => "my.domain" )

Then restart lighttpd: sudo service lighttpd restart

2 Likes

Hey Mcat12!

Thank you so much! http:/// is now displaying the correct default browser!

I'll think about the vpn pihole combination still, but for now the solution works great with my mobile celluar devices.

(Topic can be closed)

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