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

router: add REQ(header-name) header formatter #8782

Conversation

ascheglov
Copy link
Contributor

request_headers_to_add and response_headers_to_add can now use "%REQ(header-name)%"

Use cases:

  • rename a request header:
    request_headers_to_remove:
    - x-header
    request_headers_to_add:
    - header:
        key: x-new-name
        value: "%REQ(x-header)%"
  • echo a request header, including envoy-generated headers:
    response_headers_to_add:
    - header:
        key: x-header-echo
        value: "%REQ(x-header)%"
    - header:
        key: x-request-id
        value: "%REQ(x-request-id)%"

Risk Level: low
Testing: unit tests
Doc Changes: yes
Release Notes: yes
Fixes #8683

Risk Level: low
Testing: unit tests
Doc Changes: yes
Release Notes: yes
Fixes envoyproxy#8683

Signed-off-by: Anatoly Scheglov <ascheglov@yandex-team.ru>
Copy link
Member

@zuercher zuercher left a comment

Choose a reason for hiding this comment

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

Thanks! I have some comments, but I think this will be a nice feature to have.

include/envoy/stream_info/stream_info.h Outdated Show resolved Hide resolved
source/common/stream_info/stream_info_impl.h Outdated Show resolved Hide resolved
test/common/router/header_formatter_test.cc Outdated Show resolved Hide resolved
source/common/stream_info/stream_info_impl.h Outdated Show resolved Hide resolved
include/envoy/stream_info/stream_info.h Outdated Show resolved Hide resolved
@zuercher
Copy link
Member

Also there's an implementation of StreamInfo in test/common/stream_info/test_util.h that needs to be updated.

Anatoly Scheglov added 4 commits October 31, 2019 00:02
Signed-off-by: Anatoly Scheglov <ascheglov@yandex-team.ru>
Signed-off-by: Anatoly Scheglov <ascheglov@yandex-team.ru>
Signed-off-by: Anatoly Scheglov <ascheglov@yandex-team.ru>
Signed-off-by: Anatoly Scheglov <ascheglov@yandex-team.ru>
@zuercher
Copy link
Member

I think if you merge master, the coverage test will stop failing. There were a few commits to increase coverage not long after you branched.

Anatoly Scheglov added 4 commits November 1, 2019 13:52
…o_additional_resp_headers

Signed-off-by: Anatoly Scheglov <ascheglov@yandex-team.ru>
Signed-off-by: Anatoly Scheglov <ascheglov@yandex-team.ru>
Signed-off-by: Anatoly Scheglov <ascheglov@yandex-team.ru>
Signed-off-by: Anatoly Scheglov <ascheglov@yandex-team.ru>
zuercher
zuercher previously approved these changes Nov 1, 2019
Copy link
Member

@zuercher zuercher left a comment

Choose a reason for hiding this comment

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

Thanks!

@dio can you have a look as well?

zuercher
zuercher previously approved these changes Nov 5, 2019
Copy link
Member

@dio dio left a comment

Choose a reason for hiding this comment

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

Awesome.

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.

Feature request: ability to use x-request-id in response_headers_to_add
3 participants