Skip to content

[TT-13440] Multi-value response headers lost after sync with coprocess middleware #6411

@sebkehr

Description

@sebkehr

Do you want to request a feature or report a bug?

I like to report a (possible) bug.

What is the current behavior?

Currently, when synchronizing single- and multi-valued header representations of coprocess-based middleware responses (see function syncHeadersAndMultiValueHeaders in gateway/coprocess.go#L608) the list of values for any multi-valued header is replaced by a singleton list (see gateway/coprocess.go#L616) containing only the value given by its single-value representation. Thus, all multi-value header values but the first are effectively dropped. Moreover, as synchronization of multi-value headers is triggered on any change of the map containing single-value representations (see gateway/coprocess.go#L586) all multi-value header values (except the first) are dropped even if those were not even modified.

What is the expected behavior?

Header synchronization should replace only the first value and retain possibly remaining values of multi-valued headers.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem

When employing a coprocess (response) middleware to modify the Location header of a redirect response from upstream which also contains multiple Set-Cookie headers only the first Set-Cookie header will be contained in the effective response.

Which versions of Tyk affected by this issue? Did this work in previous versions of Tyk?

We discovered the behaviour with Tyk 5.3. But the mentioned code did not change since then.

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