﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	uname	nginx_version
2335	no resolver defined to resolve localhost	stefankaerst.web.de@…		"I just downloaded nginx-1.21.6.tar.gz and tried a proxy pass configuration to ""localhost""

the error.log contains
{{{
[error] 10208#0: *6 no resolver defined to resolve localhost
}}}

IMHO this is a bug because localhost can be resolved by the OS resolver. see below
2nd, the error message text ist misleading, because I do not have to configure a DNS server within nginx because the OS is responsible to provide DNS service. no one configures DNS server in e.g. haproxy,squid,a....e,varnish ;)

""localhost"" is no hostname that belongs to any global DNS zone, so it makes no sense to even put it into a DNS zone.
every major OS has ""localhost"" entries in /etc/hosts or other files accordingly to make this name available. therefore ""localhost"" is available without DNS whatsoever and even without a working network configuration e.g. offline. (as long as nsswitch works correctly)
I'm using GNU/Linux openSUSE 15.3  if that is any of interest.

using the local resolver (without DNS server):
{{{
/usr/local/nginx/sbin $ getaddrinfo localhost
family:10 socktype: 1 protocol:  6 addr:::1(28)
family: 2 socktype: 1 protocol:  6 addr:127.0.0.1(16)
/usr/local/nginx/sbin $ 

/usr/local/nginx/sbin $ getent ahosts localhost
::1             STREAM localhost
::1             DGRAM  
::1             RAW    
127.0.0.1       STREAM 
127.0.0.1       DGRAM  
127.0.0.1       RAW    
/usr/local/nginx/sbin $
}}}
mayby linked to #2259, but nginx could resolve localhost at the start or reload
"	defect	closed	minor	nginx-1.21	nginx-core		invalid			Linux linux 5.3.18-150300.59.54-default #1 SMP Sat Mar 5 10:00:50 UTC 2022 (1d0fa95) x86_64 x86_64 x86_64	"/usr/local/nginx/sbin $ ./nginx -V
nginx version: nginx/1.21.6
built by gcc 7.5.0 (SUSE Linux) 
configure arguments:"
