location /proxy/ {
internal;
rewrite ^/proxy/(https?)/([^/]+)/(\d+)/(.*) /$4 break;
proxy_pass $1://$2:$3;
}
local wechatTokenHost = 'https/api.weixin.qq.com/443'
local res = ngx.location.capture('/proxy/' .. wechatTokenHost .. '/yaotv/user/userinfo', {
method = ngx.HTTP_GET,
args = {appid=appid,access_token=token,code=code}
});
------------------
朱大仙儿
手机:18513379185
微信号:wx23456346
QQ: 23456346
天脉聚源(北京)传媒科技有限公司/互动云研发部
北京市东城区安定门东大街雍和大厦E座8层
------------------ Original ------------------
Date: Wed, Jun 15, 2016 05:55 PM
To: "openresty"<openresty@googlegroups.com>;
Subject: [openresty] Re: ngx.exec,proxy_pass https失败
谢谢您的回复!我用的是openresty+lua+redis,lua脚本获取redis中存储的IP。根据IP将请求转发至不同的后端服务器。
不使用lua脚本,https请是可以正常转发的。但使用了lua之后,只能转发http请求,转发https请求就会报错。因为我觉得可能跟lua_ssl配置有关,但是不是太熟悉,还没找到具体问题。报错日志是“[error] 3645#0: *127 peer closed connection in SSL handshake while SSL handshaking to upstream, client: 192.168.116.1, server: localhost, request: "GET /test/n.jpg HTTP/1.1", upstream: "https://127.0.0.1:8090/test/n.jpg", host: "192.168.116.145"”
在 2016年6月15日星期三 UTC+8下午5:13:09,Paul Von写道:
--