Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CnChunfeng
/
ichunt_lua_waf
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
95ae1e89
authored
Nov 09, 2020
by
Joneq
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修复日志添加以及redis链接异常自动跳转302
parent
cca96a45
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
waf.lua
waf.lua
View file @
95ae1e89
...
@@ -42,19 +42,19 @@ local ok, err = red:connect(config.redis_host, config.redis_port)
...
@@ -42,19 +42,19 @@ local ok, err = red:connect(config.redis_host, config.redis_port)
-- 如果连接失败,跳转到label处
-- 如果连接失败,跳转到label处
if
not
ok
then
if
not
ok
then
ngx
.
say
(
"failed to connect: "
,
err
)
-- ngx.say("failed to connect: ", err) 防止reds出问题影响网络去除链接错误跳转
ngx
.
exit
(
ngx
.
HTTP_FORBIDDEN
)
--
ngx.exit(ngx.HTTP_FORBIDDEN)
return
return
end
end
if
config
.
redis_auth
~=
""
then
if
config
.
redis_auth
~=
""
&&
ok
then
local
ok
,
err
=
red
:
auth
(
config
.
redis_auth
)
local
ok
,
err
=
red
:
auth
(
config
.
redis_auth
)
-- 如果连接失败,跳转到label处
-- 如果连接失败,跳转到label处
if
not
ok
then
if
not
ok
then
ngx
.
say
(
"failed to connect: "
,
err
)
-- ngx.say("failed to connect: ", err) 防止reds出问题影响网络去除链接错误跳转
ngx
.
exit
(
ngx
.
HTTP_FORBIDDEN
)
--
ngx.exit(ngx.HTTP_FORBIDDEN)
return
return
end
end
end
end
...
@@ -406,7 +406,7 @@ else
...
@@ -406,7 +406,7 @@ else
arr
[
'type'
]
=
2
arr
[
'type'
]
=
2
end
end
end
end
red
:
lpush
(
'spider_ip_info_list'
,
cjson
.
encode
(
arr
))
--
red:lpush('spider_ip_info_list',cjson.encode(arr))
--设置有效时间
--设置有效时间
res
,
err
=
red
:
expire
(
spider_time
..
user_ip
,
spider_key_exit_time
)
res
,
err
=
red
:
expire
(
spider_time
..
user_ip
,
spider_key_exit_time
)
res
,
err
=
red
:
expire
(
spider_count
..
user_ip
,
spider_key_exit_time
)
res
,
err
=
red
:
expire
(
spider_count
..
user_ip
,
spider_key_exit_time
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment