hostname support in geo (ngx_http_geo_module) variable maps?

PGNet Dev pgnet.dev at gmail.com
Mon Jul 25 14:21:33 UTC 2022


i'm running nginx/1.23.1

i use 'geo'-based (ngx_http_geo_module) permissions to restrict access to some sites
e.g., for explicit static IPs

	geo $RESTRICT_ACCESS {
		default          0;
		127.0.0.1/32     1;
		2601:...:abcd    1;
	}

	server {
		...
		if ($RESTRICT_ACCESS = 0) { return 403;}

it works as intended.

i'd like to add access for a couple of hosts with dynamic IPs.
the IPs *are* tracked, and updated to DNS.

e.g., both A & AAAA records exist, and are automatically updated on change, at

	mydynamicIP.example.com

so that, in effect,

	geo $RESTRICT_ACCESS {
		default          0;
		127.0.0.1/32     1;
		2601:...:abcd    1;
		<IPv4 addr for mydynamicIP.example.com> 1;
		<IPv6 addr for mydynamicIP.example.com> 1;
	}

at wiki, there is mention of

	"ngx_http_rdns_module"
	 https://www.nginx.com/resources/wiki/modules/rdns/

which points to

	https://github.com/flant/nginx-http-rdns

but, there

	"Disclaimer (February, 2022)
	 This module hasn't been maintained by its original developers for years already."

is there a recommended/current method for using *hostnames* in geo?  ideally, without lua.



More information about the nginx mailing list