Skip to content

Commit 5d8ff66

Browse files
aozhuochaoaozhuochao
authored andcommitted
https default
1 parent 91bea68 commit 5d8ff66

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

openresty-proxy/https-proxy/lua.https.proxy.conf

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,19 @@ server {
6767
local cert_path = ssl_dir .. "/" .. domain .. ".crt"
6868
-- ngx.log(ngx.ERR, "ggggggggggggggg---3")
6969
local key_path = ssl_dir .. "/" .. domain .. ".key"
70-
70+
71+
-- 判断是否https而且, 文件是否存在
72+
-- 也要判断default.crt是否存在
73+
if ngx.var.scheme == "https" and file_exists(cert_path) then
74+
ngx.log(ngx.INFO, "https and cert file exists")
75+
else
76+
if file_exists(ssl_dir .. "/default.crt") then
77+
ngx.log(ngx.INFO, "https and cert file not exists but use default")
78+
cert_path = ssl_dir .. "/default.crt"
79+
key_path = ssl_dir .. "/default.key"
80+
end
81+
end
82+
7183
ngx.log(ngx.INFO, cert_path)
7284
ngx.log(ngx.INFO, key_path)
7385

0 commit comments

Comments
 (0)