<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<tt>Thanks Maxim,<br>
The loopback feature you described is the work around we're using.<br>
However, the new service I'm attempting to implement, it is costly on
several fronts. <br>
My impression of reimplementation of upstream was what I was suspecting
all along.<br>
<br>
Thanks<br>
<br>
</tt><br>
Maxim Dounin wrote:
<blockquote cite="mid:20160706123353.GU30781@mdounin.ru" type="cite">
  <pre wrap="">Hello!

On Tue, Jul 05, 2016 at 05:00:03PM -0400, Charles Orth wrote:

  </pre>
  <blockquote type="cite">
    <pre wrap="">I'm new to nginx...
I would like to define upstream handler in HTTP without a HTTP server
listener. From SMTP/POP3/IMAP I would like
to use the upstream handler for my http endpoint. Thus requiring
http_upstream initialize, create a request, hand the request off to upstream
for processing and finally having HTTP upstream handler return the entire
response to my handler.
I haven't found any examples or patches where I can leverage HTTP upstream
from Mail service perspective.
Does anyone have a suggestion or an example?
    </pre>
  </blockquote>
  <pre wrap=""><!---->
This is not something you can do.  Mail and http are different 
modules, and you can't use http module features in the mail 
module.  If you want to use upstreams in mail, you have to 
reimplement them there.

Practical solution is to use one address in mail (e.g., 
127.0.0.1:8080) and additionally balance requests using http 
reverse proxy, e.g.:

mail {
    auth_http 127.0.0.1/mailauth;
    ...
}

http {
    upstream backends {
        server 127.0.0.2:8080;
        ...
    }

    server {
        listen 8080;

        location /mailauth {
            proxy_pass <a class="moz-txt-link-freetext" href="http://backends">http://backends</a>;
        }
    }
}

  </pre>
</blockquote>
</body>
</html>