Rewriting the domain part of Set-Cookie in a proxy_pass

agentzh agentzh at
Wed Sep 14 09:24:16 UTC 2011

On Wed, Sep 14, 2011 at 4:49 PM, agentzh <agentzh at> wrote:
>    server_name;
>    location / {
>        proxy_pass;
>        header_filter_by_lua '
>            local cookies = ngx.header.set_cookie
>            if not cookies then return end

Sorry, one line of Lua should be inserted right here for the case of a
single Set-Cookie response header:

            if type(cookies) ~= "table" then cookies = {cookies} end

that is, ngx.header.set_cookie will just return a single Lua string
instead of a Lua table if there's only one Set-Cookie header.


More information about the nginx mailing list