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

Retry middleware : store headers per attempts and propagate them when responding. #4299

Merged
merged 1 commit into from
Jan 7, 2019

Conversation

jlevesy
Copy link
Contributor

@jlevesy jlevesy commented Dec 17, 2018

What does this PR do?

Make the retryResponseWriter store headers written during the attempt only write them when the attempt is successful.

Fixes #3975

Motivation

The retry middleware was loosing response headers written before the request was actually sent to the backend.
This behaviour is caused by this line.

This is what was happening when sticking a request to a backend for instance (see here).

To fix that, we make the retryResponseWriter carry a header map which represent the
headers gathered for the attempt. Then we propagate this header map to the response if only we decide to respond to the client.

More

  • Added/updated tests
  • Added/updated documentation (not relevant)

@traefiker traefiker added this to the 1.7 milestone Dec 17, 2018
@ldez ldez added kind/enhancement a new or improved feature. kind/bug/fix a bug fix and removed kind/enhancement a new or improved feature. labels Dec 17, 2018
@jlevesy jlevesy force-pushed the fix-stickiness-with-retry branch from 91ecce5 to b5aa8f4 Compare December 26, 2018 10:44
Copy link
Member

@juliens juliens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@ldez ldez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@dtomcej dtomcej left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
:shipit:

The retry middleware was loosing headers written before the request was
sent to the backend.

To fix that, we make the retryResponseWithouCloseNotify carry a header map which represent the
headers gathered for the attempt. Then we write the attempt headers if only we're responding.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants