I searched through serverfault but couldn't find an answer to this. Maybe I just don't know the right keyword or it's a conceptual misunderstanding. Any help would be appreciated!
The situation:
- My local services are running behind an NGINX reverse proxy
- I use a LAN DNS on the router (Draytek) to resolve local requests to *.example.com directly to my local server (192.168.1.2).
Even if there is no internet connection, the domains will be resolved to the local server and all services are accessible. That's why I use the LAN DNS. So far, so good.
Now I want to only allow local clients to access certain services by using the NGINX access module with:
allow 192.168.1.0/24;
deny all;
But NGINX only sees the public IP of the router instead of the IP of the client (192.168.1.100) and so every request is refused:
[...] access forbidden by rule, client: 123.123.123.123, server: service.example.de, request: [...]"
My question is:
How can I distinguish between local and remote clients on NGINX in this scenario?