Skip to content

Commit

Permalink
remove unnecessary comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ksopyla committed Dec 30, 2015
1 parent abe9805 commit f34b546
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions nginx-lua.conf
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,22 @@ access_by_lua '
-- it is assumed that redis host is set to redis, default behaviour in docker
local ok, err = red:connect("redis", 6379)
if not ok then
ngx.say("Failed to connect to Redis: ", err)
ngx.log(ngx.STDERR, "Failed to connect to Redis: " .. err)
return
end

-- Extract only the hostname without the port
local frontend = ngx.re.match(ngx.var.http_host, "^([^:]*)")[1]
ngx.log(ngx.NOTICE,"frontend=" .. frontend)
print("pr frontend=" .. frontend)
ngx.log(ngx.NOTICE,"notice frontend=" .. frontend)
ngx.log(ngx.STDERR, "stdr frontend=" .. frontend)

-- Extract the domain name without the subdomain

-- special nginx lua escaping https://github.com/openresty/lua-nginx-module#special-escaping-sequences
local pattern = [=[(\\.[^.]+\\.[^.]+)$]=]
local domain_name, match_err = ngx.re.match(frontend, pattern)[1]
if domain_name then
ngx.log(ngx.NOTICE,"domain_name=" .. domain_name)
ngx.log(ngx.NOTICE,"Domain name matched: " .. domain_name)
else
ngx.log(ngx.ERR,"domain_name match error =",match_err)
ngx.log(ngx.STDERR, "Domain_name match error: " .. match_err)
end

-- Redis lookup
Expand Down

0 comments on commit f34b546

Please sign in to comment.