Fixed nginx conf issue

This commit is contained in:
2024-08-07 21:34:03 -04:00
parent 58964b60dc
commit f44284685f
5 changed files with 20 additions and 23 deletions
+5 -5
View File
@@ -25,7 +25,7 @@ http {
auto_ssl = (require "resty.auto-ssl").new()
auto_ssl:set("storage_adapter", "resty.auto-ssl.storage_adapters.redis")
auto_ssl:set("allow_domain", function(domain)
return ngx.req.toAllow
return ngx.ctx.toAllow
end)
auto_ssl:set("request_domain", function(ssl, ssl_options)
@@ -57,10 +57,10 @@ http {
return ngx.exit(598)
end
local res, err = red:hgetall("proxy_host_"..domain)
local res, err = red:hgetall("proxy_Host_"..domain)
local res = red:array_to_hash(res)
ngx.req.targetInfo = res
ngx.ctx.targetInfo = res
if not res["ip"] then
if connect("/var/run/proxy_lookup.socket") then
@@ -76,7 +76,7 @@ http {
end
end
ngx.req.targetInfo = res
ngx.ctx.targetInfo = res
if not res["ip"] then
ngx.log(ngx.ERR, "no host found for key ", domain)
@@ -84,7 +84,7 @@ http {
return false
end
ngx.req.toAllow = true;
ngx.ctx.toAllow = true;
if res['wildcard_parent'] then
return res['wildcard_parent'], err
+6 -6
View File
@@ -25,21 +25,21 @@ server {
local scheme = ngx.var.scheme
if scheme == "http" then
if ngx.req.targetInfo["forcessl"] == "true" then
if ngx.ctx.targetInfo["forcessl"] == "true" then
return ngx.redirect("https://"..host..uri, 301)
end
end
if ngx.req.targetInfo["targetssl"] == "true" then
if ngx.ctx.targetInfo["targetssl"] == "true" then
ngx.var.target_scheme = "https"
end
if ngx.req.targetInfo["host-pass-though"] == "false" then
ngx.var.header_host = ngx.req.targetInfo["ip"]
if ngx.ctx.targetInfo["host-pass-though"] == "false" then
ngx.var.header_host = ngx.ctx.targetInfo["ip"]
end
ngx.var.target = ngx.req.targetInfo["ip"]
ngx.var.target_port = ngx.req.targetInfo["targetPort"]
ngx.var.target = ngx.ctx.targetInfo["ip"]
ngx.var.target_port = ngx.ctx.targetInfo["targetPort"]
';