From e979eb4f651e93f0e7a9c75be24362aef474a81e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Thu, 7 Feb 2019 11:19:43 +0100 Subject: [PATCH] Fix ynhpanel.js access in unprotected case --- access.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/access.lua b/access.lua index a5fcc30..0340b86 100644 --- a/access.lua +++ b/access.lua @@ -348,6 +348,11 @@ if conf["unprotected_urls"] then and not is_protected() then if hlp.is_logged_in() then hlp.set_headers() + elseif string.match(ngx.var.uri, "^/ynhpanel.js$") + or string.match(ngx.var.uri, "^/ynhpanel.css$") + or string.match(ngx.var.uri, "^/ynhpanel.json$") then + local back_url = "https://" .. ngx.var.host .. ngx.var.uri .. hlp.uri_args_string() + return hlp.redirect(conf.portal_url.."?r="..ngx.encode_base64(back_url)) end return hlp.pass() end @@ -361,6 +366,11 @@ if conf["unprotected_regex"] then and not is_protected() then if hlp.is_logged_in() then hlp.set_headers() + elseif string.match(ngx.var.uri, "^/ynhpanel.js$") + or string.match(ngx.var.uri, "^/ynhpanel.css$") + or string.match(ngx.var.uri, "^/ynhpanel.json$") then + local back_url = "https://" .. ngx.var.host .. ngx.var.uri .. hlp.uri_args_string() + return hlp.redirect(conf.portal_url.."?r="..ngx.encode_base64(back_url)) end return hlp.pass() end