i have configured nginx to act as a mail proxy as per official doc:
All is fine i am able to send and receive emails through nginx mail proxy.
But after checking email headers sent through proxy it is clean that the “received from” part of message headers shows my nginx proxy ip address instead of client ip address which sent the email.
Can this be resolved somehow so that nginx will pass client ip instead of its own?
I saw some info in the docs regarding using settings like “set_real_ip_from” or “proxy protocol” and “xclient” but if i understand correctly these all either require additional configuration in upstream mail server (which i do not own/manage) or are geared for http proxy not mail.
Thanks, i already tried that, unfortunately it seems that ‘proxy_protocol’ set on listen directive is for nginx to accept incoming connections using proxy protocol ie.:
listen 993 proxy_protocol;
"The proxy_protocol parameter (1.5.12) allows specifying that all connections accepted on this port should use the PROXY protocol. "
While what is needed is that nginx mail proxy connect to upstream server with - maybe - proxy protocol. But as i understand the upstream server must also be configured to accept proxy protocol from my nginx mail proxy and then nginx could be configured to relay received proxy protocol data ie. using ‘set_real_ip_from’ and/or other headers.
That’s the problematic part i don’t fully understand so correct me if i am wrong.
To clarify - i connect mail client ie. thunderbird to my nginx mail proxy, which then upstream mail server which i do not own/manage (ie. gmail).