You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Christian Folini <ch...@netnea.com> on 2015/05/18 16:53:12 UTC

mod_lua: Accessing multiple Set-Cookie response headers

Hello,

Mod_lua gave me a few quick wins when I started to play around
with cookies on a reverse proxy. But then the obvious happened:
the backend started to issue multiple Set-Cookie response headers
in the same http response.

mod_lua returns the headers via r.headers_out, but while the
documentation states the return value is of lua-type "table",
it is actually of lua-type "userdata" and I can not seem my way
around accessing more then a single Set-Cookie header per
request. The latter is done via r.headers_out['Set-Cookie'],
but now I got stuck.

Any ideas?

Best,

Christian Folini

-- 
Christian Folini - <ch...@netnea.com>

Re: mod_lua: Accessing multiple Set-Cookie response headers

Posted by Christian Folini <ch...@netnea.com>.
Daniel,

Thank you for your swift response.

It seems I did not make myself clear and made it look like this
is a users@ question, but I think it is not.

I am not developing an application. I have the application and I
am now using mod_lua on the reverse proxy in front of the
application.

So I am running a LuaOutputFilter and want to access the
Set-Cookie headers in the response, which has been created
by the application on the backend.

lua getcookie is based on ap_cookie_read, which reads the
Cookie request header. But I need to read the Set-Cookie
response headers. All of them. And r.headers_out is only
giving me the one of them, while the application issued
multiple Cookies in multiple Set-Cookie headers.

Any hint is still appreciated, but I really doubt users@
could help me. It's a special case not covered by the 
mod_lua documentation, AFAIK.

Best,

Christian


On Mon, May 18, 2015 at 06:58:15PM +0200, Daniel Gruno wrote:
> This should really go to users@, but anyway...
> You might want to take a look at:
> 
> http://modlua.org/api/builtin#getcookie
> http://modlua.org/api/builtin#setcookie
> 
> With regards,
> Daniel.
> 
> On 2015-05-18 16:53, Christian Folini wrote:
> >Hello,
> >
> >Mod_lua gave me a few quick wins when I started to play around
> >with cookies on a reverse proxy. But then the obvious happened:
> >the backend started to issue multiple Set-Cookie response headers
> >in the same http response.
> >
> >mod_lua returns the headers via r.headers_out, but while the
> >documentation states the return value is of lua-type "table",
> >it is actually of lua-type "userdata" and I can not seem my way
> >around accessing more then a single Set-Cookie header per
> >request. The latter is done via r.headers_out['Set-Cookie'],
> >but now I got stuck.
> >
> >Any ideas?
> >
> >Best,
> >
> >Christian Folini
> >

-- 
Christian Folini - <ch...@netnea.com>

Re: mod_lua: Accessing multiple Set-Cookie response headers

Posted by Daniel Gruno <hu...@apache.org>.
This should really go to users@, but anyway...
You might want to take a look at:

http://modlua.org/api/builtin#getcookie
http://modlua.org/api/builtin#setcookie

With regards,
Daniel.

On 2015-05-18 16:53, Christian Folini wrote:
> Hello,
>
> Mod_lua gave me a few quick wins when I started to play around
> with cookies on a reverse proxy. But then the obvious happened:
> the backend started to issue multiple Set-Cookie response headers
> in the same http response.
>
> mod_lua returns the headers via r.headers_out, but while the
> documentation states the return value is of lua-type "table",
> it is actually of lua-type "userdata" and I can not seem my way
> around accessing more then a single Set-Cookie header per
> request. The latter is done via r.headers_out['Set-Cookie'],
> but now I got stuck.
>
> Any ideas?
>
> Best,
>
> Christian Folini
>