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

Add cookie handling for http client #2534

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

andreas-habel
Copy link
Contributor

In one of our integrations, we have the challenge, that every call of our http output must contain a csrf token plus a set of cookies, because the receiving server is not truly stateless.
Therefore we're calling a get token method via branch processor to receive the token and all necessary cookies, like a loadbalancer session id etc..

Unfortunately, Benthos currently does not accept multiple http headers with the same name properly, which is especially problematic for the Set-Cookie header.

This PR does not change the handling of headers in general, but it introduces a new Metadata field called Cookie which aggregates all incoming Set-Cookie headers in a ready-to-use Cookie value for subsequent calls.

Example Inbound:

Set-Cookie a=b; path=/, Httponly; Secure
Set-Cookie foo=bar; path=/

Resulting Metadata:

Cookie a=b; foo=bar

Since this would add a new metadata field whenever cookie headers are sent by the server,
I'm not sure if this would need a separate config flag to disable this feature. Or if it even must be off by default?

Signed-off-by: Andreas Habel <andreas.habel@mail.schwarz>
Signed-off-by: Andreas Habel <andreas.habel@mail.schwarz>
Signed-off-by: Andreas Habel <andreas.habel@mail.schwarz>
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 this pull request may close these issues.

None yet

1 participant