NGINX
NGINX Trac
3rd Party Modules
Security Advisories
CHANGES
OpenResty
ngx_lua
Tengine
在线学习资源
NGINX 开发从入门到精通
NGINX Modules
ngx_echo
Livid
292D
556.82D
V2EX  ›  NGINX

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

  •  
  •   Livid ·
    PRO
    · May 13, 2014 · 6888 views
    This topic created in 4424 days ago, the information mentioned may be changed or developed.
    4 replies    2014-05-28 13:24:12 +08:00
    xoxo
        1
    xoxo  
       May 13, 2014
    LazyZhu
        2
    LazyZhu  
       May 13, 2014
    我记得好像不行吧,ngx.location.capture / ngx.socket 是不能在 set_by_lua 里面用的
    fghzpqm
        3
    fghzpqm  
       May 13, 2014
    不行,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
    PRO
       May 28, 2014
    貌似今天刚刚发布的 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.

    一会试验一下。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5326 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 64ms · UTC 09:23 · PVG 17:23 · LAX 02:23 · JFK 05:23
    ♥ Do have faith in what you're doing.