-
Notifications
You must be signed in to change notification settings - Fork 2k
can't print the response header Set-Cookie in log #845
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
Comments
check the docs
the log level can be debug, info, notice, warn, error, crit, alert, or emerg. And level is error at default, your are using ngx.WARN to logging so it will be ignored. you can use ngx.ERR or set error_log level to warn |
Thanks. I change to ngx.ERR and something is printed in error.log. But it fail to get the Set-Cookie header as follow. If I change Set-Cookie to Connection, it can print the value of Connection. Seems 'or None' does not work. 2016/08/23 14:05:58 [error] 22020#22020: 1 failed to run header_filter_by_lua: header_filter_by_lua:2: bad argument #2 to 'log' (expected table to have __tostring metamethod) |
the error as the following: header_filter_by_lua:2: bad argument #2 to 'log' (expected table to have __tostring metamethod) it means your I guess you upstream return more than set-cookie header. you can check this docs carefully |
@detailyang , you are right. Thanks. |
Hi,
I try to print the response header Set-Cookie to log by:
header_filter_by_lua_block {
ngx.log(ngx.WARN, "Set-Cookie %s", ngx.resp.get_headers()['Set-Cookie'] or "None")
}
But I get nothing in access.log or error.log.
Thanks
The text was updated successfully, but these errors were encountered: