Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-value response headers lost after sync with coprocess middleware #6411

Open
sebkehr opened this issue Jul 11, 2024 · 0 comments · May be fixed by #6394
Open

Multi-value response headers lost after sync with coprocess middleware #6411

sebkehr opened this issue Jul 11, 2024 · 0 comments · May be fixed by #6394

Comments

@sebkehr
Copy link

sebkehr commented Jul 11, 2024

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.

@sebkehr sebkehr changed the title multi-value response headers after sync lost with coprocess middleware Multi-value response headers after sync lost with coprocess middleware Jul 11, 2024
@sebkehr sebkehr changed the title Multi-value response headers after sync lost with coprocess middleware Multi-value response headers lost after sync with coprocess middleware Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant