I'm using a new "proxy_smtp_auth on;" option in my mail proxy server inside k8s cluster, therefore I just need to proxy_pass smtp requests to the backend. Since the backend must be set using the "auth_http" directive, I use the code below and provide the hostname instead of IP address:
server {
listen 127.0.0.1:8025;
server_name _;
access_log off;
location / {
add_header "Auth-Server" "smtp-hostname.local";
add_header "Auth-Port" "25";
return 200;
}
}
Unfortunately nginx even with the resolver enabled in mail section doesn't resolve the hostname:
auth http server 127.0.0.1:8025 sent invalid server address:"smtp-hostname.local" while in http auth state
It is also not clear how to resolve the "smtp-hostname.local" hostname to an IP address in the "127.0.0.1:8025" listener. Using LUA is an overkill. Any suggestions on how to dynamically resolve the smtp upstream hostname?