From 0823062e309385e2f70143ea6345dc6605776d41 Mon Sep 17 00:00:00 2001 From: opi Date: Thu, 23 Feb 2017 23:14:03 +0100 Subject: [PATCH] [fix] Escape dash in domain before matching. --- access.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/access.lua b/access.lua index 68895bf..dbdf0b2 100644 --- a/access.lua +++ b/access.lua @@ -93,7 +93,8 @@ then -- In case the `back_url` is not on the same domain than the -- current one, create a redirection with a CDA key - if not string.match(back_url, "^http[s]?://"..ngx.var.host.."/") + local ngx_host_escaped = ngx.var.host:gsub("-", "%%-") -- escape dash for pattern matching + if not string.match(back_url, "^http[s]?://"..ngx_host_escaped.."/") and not string.match(back_url, ".*"..conf.login_arg.."=%d+$") then local cda_key = hlp.set_cda_key() if string.match(back_url, ".*?.*") then