NGINX: Added redirect to /login if no auth key
This commit is contained in:
parent
a6b2bb16a0
commit
fb3b14522f
@ -102,7 +102,18 @@ server {
|
||||
set $csp "";
|
||||
access_by_lua '
|
||||
local accept_header = ngx.req.get_headers()["Accept"]
|
||||
if ngx.req.get_method() == "GET" and accept_header ~= nil and string.find(accept_header, "html") and not ngx.re.match(ngx.var.request_uri, "ds-vpath") then
|
||||
if ngx.req.get_method() == "GET" and accept_header ~= nil and string.find(accept_header, "html") and not ngx.re.match(ngx.var.request_uri, "ds-vpath|/api/") then
|
||||
|
||||
if not ngx.re.match(ngx.var.request_uri, "login|thirdparty|confirm|error|wizard|preparation-portal|unavailable|share=.|rooms/share(.*)key=.|/s/*") then
|
||||
if ngx.var.http_cookie == nil or not string.find(ngx.var.http_cookie, "asc_auth_key") then
|
||||
if ngx.var.request_uri == "/" then
|
||||
return ngx.redirect("/login")
|
||||
else
|
||||
return ngx.redirect("/login?referenceUrl=" .. ngx.var.request_uri)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local key = string.format("csp:%s",ngx.var.host)
|
||||
local redis = require "resty.redis"
|
||||
local red = redis:new()
|
||||
|
Loading…
Reference in New Issue
Block a user