Lua Paywall (deprecated)
Custom server side paywall, with Lua
How it works
# Run authentication check except these filetypes.
set $ew_auth_var "closed";
set_by_lua_file $check_auth '/opt/openresty/site/lualib/check-auth.lua';
rewrite_by_lua_file '/opt/openresty/site/lualib/auth.lua';-- Only check this against request that have check_auth
if ngx.var.check_auth ~= "true" then
return
end
ngx.req.clear_header("X-EW-Auth")
ngx.req.clear_header("X-EW-AuthEnvironment")
-- TODO: Logic that integrates the authorization system to determine user status.
local ew_auth = '';
ngx.req.set_header("X-EW-Auth", ew_auth);
local cache_key = 'closed'
if ew_auth == 'true' then
cache_key = 'open'
elseif ew_auth == 'false' then
cache_key = 'expired'
elseif ew_auth == 'noaccess' then
cache_key = 'noaccess'
end
ngx.var.ew_auth_var = cache_keyUsage in Naviga Web php code
Last updated