@@ -14,25 +14,22 @@ access_by_lua '
14
14
-- it is assumed that redis host is set to redis, default behaviour in docker
15
15
local ok, err = red:connect("redis", 6379)
16
16
if not ok then
17
- ngx.say( "Failed to connect to Redis: ", err)
17
+ ngx.log(ngx.STDERR, "Failed to connect to Redis: " .. err)
18
18
return
19
19
end
20
20
21
21
-- Extract only the hostname without the port
22
22
local frontend = ngx.re.match(ngx.var.http_host, "^([^:]*)")[1]
23
- ngx.log(ngx.NOTICE,"frontend=" .. frontend)
24
- print("pr frontend=" .. frontend)
25
- ngx.log(ngx.NOTICE,"notice frontend=" .. frontend)
26
- ngx.log(ngx.STDERR, "stdr frontend=" .. frontend)
23
+
27
24
-- Extract the domain name without the subdomain
28
25
29
26
-- special nginx lua escaping https://github.com/openresty/lua-nginx-module#special-escaping-sequences
30
27
local pattern = [=[(\\.[^.]+\\.[^.]+)$]=]
31
28
local domain_name, match_err = ngx.re.match(frontend, pattern)[1]
32
29
if domain_name then
33
- ngx.log(ngx.NOTICE,"domain_name= " .. domain_name)
30
+ ngx.log(ngx.NOTICE,"Domain name matched: " .. domain_name)
34
31
else
35
- ngx.log(ngx.ERR,"domain_name match error =", match_err)
32
+ ngx.log(ngx.STDERR, "Domain_name match error: " .. match_err)
36
33
end
37
34
38
35
-- Redis lookup
0 commit comments