Skip to content

Lua Examples (Authoritative LUA records)

Peter van Dijk edited this page Jul 5, 2023 · 6 revisions

Using Lua to simulate CNAME-like behaviour on the zone apex

If you cannot use ALIAS records because you depend on the DNSSEC live signing feature, you can use LUA-records as an alternative. The example below utilizes a CNAME record (www.example.com) inside the zone to point the actual target and provides an A (IPv4) and AAAA (IPv6) record.

example.com     3600 IN LUA   A ";local r=resolve('www.mycdn.example.net', pdns.A) local t={} for _,v in ipairs(r) do table.insert(t, v:toString()) end return t"
example.com     3600 IN LUA   AAAA ";local r=resolve('www.mycdn.example.net', pdns.AAAA) local t={} for _,v in ipairs(r) do table.insert(t, v:toString()) end return t"
www.example.com 3600 IN CNAME example.com
Clone this wiki locally