nginx as an IMAP proxy

André Rodier andre at rodier.me
Thu Apr 18 09:55:24 UTC 2019


Hello,

I have a question for nginx masters.

I am using Debian Stretch, with Dovecot as a mail server, and two 
webmails, Roundcube and SOGo. Roundcube is configured to pass the ID 
command with the original IP address 'ID ( "x-originating-ip" 
xx.xx.xx.xx )', so Dovecot logs the remote IP correctly, and not 
127.0.0.1. So, I know my set-up us working fine.

However, there is a bug in SOGo, because the command is sent only after 
authentication, and Dovecot logs the remote IP as 127.0.0.1.

Is there any way, by using nginx as an IMAP proxy, to inject the remote 
IP address, from an environment variable, passed by the nginx instance 
that serves the web frontend?


   rip=12.34.56.78                                  ID ( 
"x-originating-ip" 12.34.56.78)
[nginx web frontend]   =>   [Sogo backend]   =>            [  nginx IMAP 
proxy  ]           =>    [Dovecot IMAP server]

I have raised the bug on the SOGo web site, but I think it will be long 
to fix, and I prefer to avoid recompiling the SOGo source code.

Thanks for your help and your ideas,
André


More information about the nginx mailing list