location /nt {
default_type 'text/plain';
content_by_lua_file check_parameters.lua;
}-- Client IP
local client_ip = ngx.var.remote_addr or ''
-- check IP blockage
local is_ip_allowed = check_ip( client_ip )
if is_ip_allowed == true then
local url_params = extract_info( ngx.var.request_uri )
-- check has parameters
if (url_params['username'] == nil) or (url_params['password'] == nil) or (url_params['username'] == '') or (url_params['password'] == '') then
ngx.say('Invalid request!')
else
-- Redis query key
local user_redis_key = "line_" .. url_params['username'] .. '_' .. url_params['password']
local searched_user = redis_find( user_redis_key ) -- by function in another file
if searched_user['status'] == false then
ngx.say( searched_user['msg'] )
else
-- user found in redis
ngx.say('Request is fine! lets proxy_pass it to main server')
-- ************** HERE I NEED TO PASS REQUEST TO THE MAIN SERVER BECAUSE THE REQUEST IS VALID. BUT HOW?????????????
end
end
else
-- IP blocked
ngx.say('Access forbidden')
end--
You received this message because you are subscribed to the Google Groups "openresty-en" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openresty-en...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openresty-en/b12a5929-cc44-4540-beec-43150cb9ea35%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Yeah it fixed. thanx