-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: Generates lot of useless logs when cookie not found #4516
Labels
good first issue
Good for newcomers
Comments
We can do the check inside Line 114 in d902cb1
|
@spacewander How about this ? @@ -111,7 +111,11 @@ end
do
local var_methods = {
method = ngx.req.get_method,
- cookie = function () return ck:new() end
+ cookie = function ()
+ if ngx.var.http_cookie then
+ return ck:new()
+ end
+ end
}
local ngx_var_names = {
@@ -153,7 +157,7 @@ do
if cookie then
local err
val, err = cookie:get(sub_str(key, 8))
- if not val then
+ if err then
log.warn("failed to fetch cookie value by key: ",
key, " error: ", err)
end |
Look like we don't need to change this part: "if not val then"? |
I think that value does not exist is not an error. The log should be recorded when err exists.
|
Yes, you are right. |
@slene |
4 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Issue description
Environment
apisix version
): 2.6uname -a
): centos 7.8Minimal test code / Steps to reproduce the issue
When cookie cookie_upstream not found.
When cookie header not exists.
It generates a lot of useless logs. If this is unexpected, I can submit a pr.
The text was updated successfully, but these errors were encountered: