V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
NGINX
NGINX Trac
3rd Party Modules
Security Advisories
CHANGES
OpenResty
ngx_lua
Tengine
在线学习资源
NGINX 开发从入门到精通
NGINX Modules
ngx_echo
Livid
V2EX  ›  NGINX

NGX LUA 可以在 set_by_lua 阶段读取到源站的 response header 里的 Set-Cookie 值么?

  •  
  •   Livid · 2014-05-13 10:24:56 +08:00 · 6178 次点击
    这是一个创建于 3649 天前的主题,其中的信息可能已经有所发展或是发生改变。
    4 条回复    2014-05-28 13:24:12 +08:00
    xoxo
        1
    xoxo  
       2014-05-13 11:42:02 +08:00
    LazyZhu
        2
    LazyZhu  
       2014-05-13 12:25:44 +08:00
    我记得好像不行吧,ngx.location.capture / ngx.socket 是不能在 set_by_lua 里面用的
    fghzpqm
        3
    fghzpqm  
       2014-05-13 19:24:47 +08:00
    不行,set_by_lua 是运行在 rewrite 阶段,并且:

    『This directive is implemented by injecting custom commands into the standard HttpRewriteModule's command list. Because HttpRewriteModule does not support nonblocking I/O in its commands, Lua APIs requiring yielding the current Lua "light thread" cannot work in this directive.』

    http://wiki.nginx.org/HttpLuaModule#set_by_lua
    Livid
        4
    Livid  
    MOD
    OP
       2014-05-28 13:24:12 +08:00
    貌似今天刚刚发布的 1.7.1 里可以了:

    http://nginx.org/en/docs/http/ngx_http_upstream_module.html

    $upstream_cookie_name
    cookie with the specified name sent by the upstream server in the “Set-Cookie” response header field (1.7.1). Only the last server’s response header fields are saved.

    一会试验一下。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5796 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 06:41 · PVG 14:41 · LAX 23:41 · JFK 02:41
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.