2014-05-16 50 views
1

我已经设置了一个POP3反向代理,并且正在用于服务多个域。我正在考虑将请求的主机名作为自定义标头传递给auth脚本,但我不知道如何。nginx反向代理pop3发送主机名到授权脚本

的nginx.conf文件的相关部分是:

mail { 
    server_name mail.example.com; 
    auth_http 10.169.15.199:80/auth_script.php; 
    auth_http_timeout 5000; 
    proxy on; 
    proxy_pass_error_message on; 

    pop3_capabilities "LAST" "TOP" "USER" "PIPELINING" "UIDL"; 

    server { 
     protocol pop3; 
     listen  110; 
     pop3_auth plain; 
     auth_http_header X-Auth-Port 110; 
     auth_http_header User-Agent "Nginx POP3/IMAP4 proxy"; 
     auth_http_header my_hostname $host; 
    } 
} 

我试着用这样的:

auth_http_header my_hostname $host; 

期待nginx的更换$主机与实际的主机名,但它不发生,auth脚本接收$ _SERVER [MY_HOSTNAME] ='$ host'。

有什么办法可以做到这一点?

回答

0

获取身份验证主机的唯一方法是进行身份验证,如[email protected],并在身份验证标头中拆分主机名的一部分。

如果你想代理auth到多个域我写了module in perl