Hello fellow self-hosters. Is it possible to use NGINX as a proxy for an IMAP service where the IMAP server is located on a different host? I have a cloud VPS running NGINX which is connected to my home network via a WireGuard tunnel. What I would like to do is run the IMAP server (Dovecot) in my own network and have NGINX proxy the connection. I have tried doing searches based on this but the examples don’t show how to specify the IMAP server for the connection to be redirected to for the lack of a better phrase. I know streaming is possible. Would this be the way to do?
I would love an example to go on. Thanks very much!
You can do TCP proxying with nginx but many of the same features available in haproxy are behind the paywall. In nginx, layer 4 connections are dealt with through streams. You can do both TCP and UDP. I stick with haproxy for TCP streams with very few exceptions. HAproxy is most definitely more robust for situations where you have a pool of upstream servers. For single upstream instances, it’s not terrible. Most of the features I would use for better control of how the failover and balancing would work isn’t available in the open source nginx.