Run docker compose up to start the following services defined in the
compose.yaml file:
whoami-1: Example service (allowed)whoami-2: Example service (blocked)geoblock: Geoblock servicenginx: Reverse proxy
This example will use the configuration defined in the config.yaml
file. NGINX configuration is defined in the nginx.conf file.
The rules in config.yaml are configured to:
- Allow requests where the host is
whoami-1.local - Deny requests where the host is
whoami-2.local
In a different console, use curl to test the services:
✅ Allowed:
Request:
$ curl -fH "Host: whoami-1.local" http://localhost:8080
Hostname: faf5680d9138
IP: 127.0.0.1
IP: 172.20.0.3
RemoteAddr: 172.20.0.5:35620
GET / HTTP/1.1
Host: whoami-1.local
User-Agent: curl/8.7.1
Accept: */*
Connection: closeLogs:
geoblock-1 | time="2025-01-06T09:30:19Z" level=info msg="Request authorized" request_domain=whoami-1.local request_method=GET source_asn=0 source_country= source_ip=172.20.0.1 source_org=
❌ Blocked:
Request:
$ curl -fH "Host: whoami-2.local" http://localhost:8080
curl: (22) The requested URL returned error: 403Logs:
geoblock-1 | time="2025-01-06T09:30:38Z" level=warning msg="Request denied" request_domain=whoami-2.local request_method=GET source_asn=0 source_country= source_ip=172.20.0.1 source_org=