How to extract multiple values of a header for logging

I have a custom header in http response and it can appear more than
once.
Let’s say it is called x-extra.

In my nginx configuration, I want to extract all of its values and log
them
together but I found it is always extracting the very first one. Is it
possible to do this somehow?

Thanks in advance!
-K

Posted at Nginx Forum:

Hello!

On Wed, Nov 19, 2014 at 03:09:16PM -0500, keeyong wrote:

I have a custom header in http response and it can appear more than once.
Let’s say it is called x-extra.

In my nginx configuration, I want to extract all of its values and log them
together but I found it is always extracting the very first one. Is it
possible to do this somehow?

I don’t think it’s currently possible.


Maxim D.
http://nginx.org/

Thanks Maxim for the confirmation

Posted at Nginx Forum:

This is possible using if you are able to use the Lua module:

“For multiple instances of request headers … the value of
ngx.req.get_headers()[“Foo”] will be a Lua (array) table…”

Good to know. I don’t have the module installed though. But I will keep
that
in mind. Thanks!

Posted at Nginx Forum: