I changed the IP address into my php script and i think we are moving on, now i'm seening the next error into my logs:
*6 upstream sent invalid response: "550 5.7.0 Error: insufficient authorization" while reading response from upstream, client: 192.168.122.1 using starttls, server: 0.0.0.0:587, login: "ricardo.carrillo", upstream: 192.168.122.78:25
2015/03/12 21:02:18 [info] 2375#0: *6 upstream sent invalid response: "550 5.7.0 Error: insufficient authorization" while reading response from upstream, client: 192.168.122.1 using starttls, server: 0.0.0.0:587, login: "ricardo.carrillo", upstream: 192.168.122.78:25
The response for the manual auth_http request is:
[root@proxy-n1 ~]# curl -v -H "Host:192.168.122.170" -H "Auth-Method:plain" -H "Auth-User:ricardo.carrillo" -H "Auth-pass:r3dh4t" -H "Auth-Protocol:imap" -H "Auth-Login-Attempt:1" -H "Client-IP: 192.168.122.1" http://192.168.122.170:80/correo-proxy-auth/auth2.php
* About to connect() to 192.168.122.170 port 80 (#0)
* Trying 192.168.122.170...
* Connected to 192.168.122.170 (192.168.122.170) port 80 (#0)
> GET /correo-proxy-auth/auth2.php HTTP/1.1
> User-Agent: curl/7.29.0
> Accept: */*
> Host:192.168.122.170
> Auth-Method:plain
> Auth-User:ricardo.carrillo
> Auth-pass:r3dh4t
> Auth-Protocol:imap
> Auth-Login-Attempt:1
> Client-IP: 192.168.122.1
>
< HTTP/1.1 200 OK
< Server: nginx/1.6.2
< Date: Fri, 13 Mar 2015 02:06:37 GMT
< Content-Type: text/html
< Transfer-Encoding: chunked
< Connection: keep-alive
< X-Powered-By: PHP/5.4.16
< Auth-Status: OK
< Auth-Server: 192.168.122.78
< Auth-Port: 143
<
* Connection #0 to host 192.168.122.170 left intact