Apply suggestions from code review
Co-authored-by: Marco Ebert <marco_ebert@icloud.com>
This commit is contained in:
parent
07d530b217
commit
1f3da80d4e
3 changed files with 7 additions and 7 deletions
|
@ -1,12 +1,12 @@
|
||||||
local auth_path = ngx.var.auth_access_path
|
local auth_path = ngx.var.auth_path
|
||||||
local keepalive_shared_vars = ngx.var.keep_alive_share_vars
|
local auth_keepalive_share_vars = ngx.var.auth_keepalive_share_vars
|
||||||
local auth_response_headers = ngx.var.auth_response_headers
|
local auth_response_headers = ngx.var.auth_response_headers
|
||||||
local ngx_re_split = require("ngx.re").split
|
local ngx_re_split = require("ngx.re").split
|
||||||
local ipairs = ipairs
|
local ipairs = ipairs
|
||||||
local ngx_log = ngx.log
|
local ngx_log = ngx.log
|
||||||
local ngx_ERR = ngx.ERR
|
local ngx_ERR = ngx.ERR
|
||||||
|
|
||||||
local res = ngx.location.capture(auth_path, { method = ngx.HTTP_GET, body = '', share_all_vars = keepalive_shared_vars })
|
local res = ngx.location.capture(auth_path, { method = ngx.HTTP_GET, body = '', share_all_vars = auth_keepalive_share_vars })
|
||||||
if res.status == ngx.HTTP_OK then
|
if res.status == ngx.HTTP_OK then
|
||||||
local header_parts, err = ngx_re_split(auth_response_headers, ",")
|
local header_parts, err = ngx_re_split(auth_response_headers, ",")
|
||||||
if err then
|
if err then
|
||||||
|
|
|
@ -1185,8 +1185,8 @@ stream {
|
||||||
{{- end }}
|
{{- end }}
|
||||||
# `auth_request` module does not support HTTP keepalives in upstream block:
|
# `auth_request` module does not support HTTP keepalives in upstream block:
|
||||||
# https://trac.nginx.org/nginx/ticket/1579
|
# https://trac.nginx.org/nginx/ticket/1579
|
||||||
set $auth_access_path '{{ $authPath }}';
|
set $auth_path '{{ $authPath }}';
|
||||||
set $keep_alive_share_vars {{ $externalAuth.KeepaliveShareVars }};
|
set $auth_keepalive_share_vars {{ $externalAuth.KeepaliveShareVars }};
|
||||||
set $auth_response_headers '{{ buildAuthUpstreamLuaHeaders $externalAuth.ResponseHeaders }}';
|
set $auth_response_headers '{{ buildAuthUpstreamLuaHeaders $externalAuth.ResponseHeaders }}';
|
||||||
access_by_lua_file /etc/nginx/lua/nginx/ngx_conf_external_auth.lua;
|
access_by_lua_file /etc/nginx/lua/nginx/ngx_conf_external_auth.lua;
|
||||||
{{ else }}
|
{{ else }}
|
||||||
|
|
|
@ -653,7 +653,7 @@ http {
|
||||||
func(server string) bool {
|
func(server string) bool {
|
||||||
return strings.Contains(server, `upstream auth-external-auth`) &&
|
return strings.Contains(server, `upstream auth-external-auth`) &&
|
||||||
strings.Contains(server, `keepalive 10;`) &&
|
strings.Contains(server, `keepalive 10;`) &&
|
||||||
strings.Contains(server, `set $keep_alive_share_vars false;`)
|
strings.Contains(server, `set $auth_keepalive_share_vars false;`)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -673,7 +673,7 @@ http {
|
||||||
func(server string) bool {
|
func(server string) bool {
|
||||||
return strings.Contains(server, `upstream auth-external-auth`) &&
|
return strings.Contains(server, `upstream auth-external-auth`) &&
|
||||||
strings.Contains(server, `keepalive 10;`) &&
|
strings.Contains(server, `keepalive 10;`) &&
|
||||||
strings.Contains(server, `set $keep_alive_share_vars true`)
|
strings.Contains(server, `set $auth_keepalive_share_vars true`)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue