I can add cookies by doing: add_header Set-Cookie 'mycookie=123';
then read and check if it exists by doing: ngx.var.cookie_mycookie
However I can't do this e.g.
location /test {
content_by_lua_block {
ngx.header['Set-Cookie'] = 'mycookie=123; path=/'
ngx.say(ngx.var.cookie_mycookie)
}
}
The output value is simply nil. I also tried output whole request header, and the cookie is not even there.
I checked so no other header is sent before, and it's all clean, and no proxies. Using newest OpenResty version. Default.
Any idea? Thanks.