Minimal example
Machine A and B, where B uses mDNS with domain name b.local
and set ssh service at port 2222. A and B does not turn on firewall.
In machine A's nginx.conf
:
stream {
upstream b-ssh {
server b.local:2222;
}
server {
listen 2222;
listen [::]:2222;
proxy_pass b-ssh;
}
}
When using nginx -t
to test this configuration on machine A, error occurred:
[emerg] host not found in upstream "b.local:2222"
However, in machine A, using ssh -p 2222 b.local
works normally (-4
or -6
is also tested)
Possibly useful infos
In my real-world example, machine A is a Windows 11 which disables all firewalls; machine B is WSL2 ubuntu 21.10 inside machine A which uses avahi-daemon mDNS service.
In side machine A's nginx.conf
, I also set an HTTP proxy pass:
http {
server {
listen 8929;
listen [::]:8929;
location / {
proxy_pass http://b.local:8929;
}
}
}
and this works well even though this uses mDNS domain name.
If I replace mDNS domain name with its real IP in upstream server, the SSH proxy works.