diff --git a/modules/policy/policy.lua b/modules/policy/policy.lua
index 1183883f2462bc51aa9c2d1b1d781448e418c164..05c1099a51a37c12b6187d37cb88f38727fe39e4 100644
--- a/modules/policy/policy.lua
+++ b/modules/policy/policy.lua
@@ -145,25 +145,18 @@ local function localhost(state, req)
 	ffi.C.kr_pkt_make_auth_header(answer)
 
 	local is_exact = ffi.C.knot_dname_is_equal(qry.sname, dname_localhost)
-	if not is_exact then
-		answer:rcode(kres.rcode.NXDOMAIN)
-		answer:begin(kres.section.AUTHORITY)
-		mkauth_soa(answer, dname_localhost)
-		return kres.DONE
-	end
 
 	answer:rcode(kres.rcode.NOERROR)
 	answer:begin(kres.section.ANSWER)
 	if qry.stype == kres.type.AAAA then
-		answer:put(dname_localhost, 900, answer:qclass(), kres.type.AAAA,
+		answer:put(qry.sname, 900, answer:qclass(), kres.type.AAAA,
 			'\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1')
 	elseif qry.stype == kres.type.A then
-		answer:put(dname_localhost, 900, answer:qclass(), kres.type.A, '\127\0\0\1')
-	elseif qry.stype == kres.type.SOA then
+		answer:put(qry.sname, 900, answer:qclass(), kres.type.A, '\127\0\0\1')
+	elseif is_exact and qry.stype == kres.type.SOA then
 		mkauth_soa(answer, dname_localhost)
-	elseif qry.stype == kres.type.NS then
-		answer:put(dname_localhost, 900, answer:qclass(), kres.type.NS,
-			dname_localhost)
+	elseif is_exact and qry.stype == kres.type.NS then
+		answer:put(dname_localhost, 900, answer:qclass(), kres.type.NS, dname_localhost)
 	else
 		answer:begin(kres.section.AUTHORITY)
 		mkauth_soa(answer, dname_localhost)