nginx – Configuring NGINX as a Mail Proxy Server with Load Balancing Based on User

email-serverhaproxynginxPROXY

I'm currently looking at options for a mail server proxy that will select an upstream server based on the user that was authenticated. I didn't see anything like that mentioned in the NGINX guide for configuring a mail proxy server, but is there anyway that this can be done with NGINX? If not, is there some other proxy solution that would allow this to be done?

I see that NGNIX allows several methods for selecting the load balancing server, but I didn't see any that would allow the server to be selected by the authenticated user. (The link here is for HTTP load balancing, but I'm guessing the same rules are allowed for SMTP traffic as well.)

If not possible with NGNIX, is this possible with HAproxy?

Best Answer

Yes, you can. The mail server for the user can be selected with the same script that authorizes the user. Just follow the guide given here by NGINX.