Skip to content

Add RESP(header-name) header formatter #15036

@mattrobenolt

Description

@mattrobenolt

Specifically I'm looking for support within response_headers_to_add.

I'd like to do something like:

response_headers_to_add:
- header:
    key: x-served-by
    value: '%HOSTNAME%,%RESP(X-SERVED-BY)%'

The usecase is rather petty, because append: true can be used. But this yields duplicate headers, which is fine by spec, but it's harder to trace a path since there's no explicit ordering. We use this pattern which ends up being formatted similarly to an X-Forwarded-For header where the path keeps getting appended through the stack.

Ultimately, the yielded header would be:

x-served-by: lb-01,web-01

vs what we can do now as:

x-served-by: web-01
x-served-by: lb-01

I tried to look through the code for the header formatter, and I'm far from being good at C++. I think the issue, from what I was able to understand, is that the header formatter is shared and also is used for request_headers_to_add which means the formatter itself doesn't assume or doesn't even know yet that there are HTTP headers. I'm guessing if that's the case, in general this would be problematic and need guards around doing config like:

request_headers_to_add:
- header:
    key: foo
    value: '%RESP(xxx)%'

Support for REQ formatting: #8782

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions