11 Nov 2026
More Cloudflare Shenanigans
Using Cloudflare Par t 2
I tried to host a website only accessible from my friend's website and my website. And I learn a bit more about networking while on the way there. This line diagram is the general idea
Visitor on an allowed network
|
| DNS lookup finds Cloudflare’s public addresses
| Browser connects using HTTPS, over IPv4 or IPv6 (this will come back later)
v
Cloudflare
|
| Yeah
v
cloudflared on homeserver
|
| Local HTTP connection to 127.0.0.1:8082
v
Caddy in Docker
|
| Check the visitor’s IP against the allowlist
+-- allowed --> serve HTML, images, videos and downloads
+-- denied --> return 403 Forbidden
During this set up process I learnt about port forwarding, and came to appreciate what cloudflared was doing for me (and this website specifically). DHCP is the mechanism routers commonly use to assign local addresses. Assignments can change. A DHCP reservation tells the router to give a particular device a chosen local address consistently.
Basically, IP addresses change all the time. Port forwarding is a method for routers to lock the IP address. Unfortunately, I'd need the admin password to set up port forwarding on my router. And I'm not on speaking terms with dad.
A private LAN address associated with every router is called a private LAN addtess.
127.0.0.1 for IPv4 and ::1 for IPv6 mean this machine itself.
fe80: fpr the local link, not as the public website visitor address
Docker addresses are normally 172.18.x.x
www is the subdomain of facebook.com. So I made use of a subdomain to host my friend's private website.
I also realise the number at the end of an ip address (e.g. 192.168.0.0:xxxx) is called the port. It's a numbered endpoint for a specific service.
When looking at ip -br addr, identify the active physical interface. Names
beginning with wlp usually indicate Wi-Fi; enp or eth commonly indicate
Ethernet. Names such as docker0, br-… and veth… usually describe virtual
networking.
0.0.0.0 as a listening address means all local IPv4 interfaces. Binding
Caddy to 127.0.0.1 instead keeps that listener off the LAN and Internet.
The same address can mean different things in different contexts, so distinguish
a service’s bind address from a visitor’s source address.
5IPv4 often gives a home network one shared public identity
Home IPv4 connections commonly use NAT, which translates multiple private device addresses into one public address for outbound traffic.
Phone 192.168.0.20 --+
Laptop 192.168.0.21 --+--> router/NAT --> shared public IPv4
Homeserver 192.168.0.7 --+
This is why allowing a household’s public IPv4 address often allows all its devices. However, an IP address is not proof of a particular Wi-Fi name or person:
- Ethernet and Wi-Fi devices may share the same Internet connection.
- A guest network might use the same public IPv4 address.
- A VPN can make a device appear to come from somewhere else.
- Some ISPs use carrier-grade NAT (CGNAT), sharing public IPv4 addresses across customers.
- A home’s public address can change.
The rule actually means “allow requests arriving from this public address,” not “authenticate membership of this SSID.” An SSID is the Wi-Fi’s advertised name.
IPv6 usually gives devices their own public addresses
Devices on an IPv6-enabled home network commonly have different global IPv6 addresses while sharing a network prefix. A device can have several addresses, including temporary privacy addresses that rotate.
For example, these observed addresses belong to the same /64:
Computer: 2400:79e0:c01:3e30:823a:e707:5827:9737
Phone: 2400:79e0:c01:3e30:a831:5431:5173:1e82
Homeserver: 2400:79e0:c01:3e30:4374:ac4b:a189:606
-------------------
shared network prefix
What /64 means
IPv6 addresses contain 128 bits. /64 means the first 64 bits identify the
allowed network; the remaining 64 bits can vary.
In a fully expanded IPv6 address, each colon-separated hexadecimal group holds
16 bits. Therefore, a /64 fixes the first four groups:
2400:79e0:c01:3e30::/64
It includes:
2400:79e0:c01:3e30::1
2400:79e0:c01:3e30:a831:5431:5173:1e82
2400:79e0:c01:3e30:ffff:ffff:ffff:ffff
It does not include:
2400:79e0:c01:3e31::1
:: compresses consecutive groups of zeros. Prefix matching operates on bits,
not on a naive text comparison of compressed address strings.
Why local HTTPS throws 502
The local service must use the protocol its listener actually speaks. Setting
the tunnel route to https://127.0.0.1:8082 caused a 502 because Caddy was
listening for HTTP there.
Various Errors
| Symptom | What it tells me | What to investigate |
|---|---|---|
DNS_PROBE_FINISHED_NXDOMAIN |
The browser’s lookup says the hostname does not exist | Spelling, browser/system DNS, cached failures, DNS filtering |
| Connection timeout | A connection did not complete in time | Connectivity, firewall, routing or listener availability |
No route to host over SSH |
The network could not successfully reach that destination | Address, route, LAN connectivity or rejection |
| TLS/certificate error | HTTPS validation or negotiation failed | Hostname, certificate, clock, TLS configuration |
502 Bad Gateway |
A proxy could not obtain a valid upstream response | Tunnel destination, service health, HTTP versus HTTPS |
403 Forbidden |
An HTTP-speaking component refused the request | Source IP, access policy, proxy/relay path |
404 Not Found |
The responding service did not provide that resource | Path, hostname mapping, removed/private resource |
200 OK |
The HTTP request succeeded | Check that the body is the expected site |
206 Partial Content |
A requested byte range was returned | Expected for video seeking and partial downloads |