mail nginx java,nginx做mail proxy 的时候,把消息proxy到哪里去了

最近研究nginx代码, 以mail模块入手, 但是从配置看, 一直看不出来nginx把消息proxy到哪里去了.

今天研究了半天, 才搞这个事情搞清楚. 之前在网上也没有找到类似的说明, 包括官方的文档也没有说明.

mail模块有一个ngx_mail_auth_http_module.c模块, 其中有一个配置命令auth_http,nginx通过向此配置发送一个http请求,以获取得后端mail server的ip和端口. 比如:

Request:

GET /auth HTTP/1.0

Host: localhost

Auth-Method: plain # plain/apop/cram-md5

Auth-User: user

Auth-Pass: password

Auth-Protocol: imap # imap/pop3/smtp

Auth-Login-Attempt: 1

Client-IP: 192.0.2.42

Client-Host: client.example.org

Good response:

HTTP/1.0 200 OK

Auth-Status: OK

Auth-Server: 198.51.100.1

Auth-Port: 143

以上的Request是nginx发送给auth_http配置的url的请求,Good response是相应响应. nginx从这个响应中的Auth-Server和Auth-Port获取得到后端mail server的ip和端口. nginx会连接到这个ip:port,并与此按相就的邮件协议(如POP3)交互.

同时

If the “Auth-User” header exists in the response, it overrides the username used to authenticate with the backend.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值