-
Notifications
You must be signed in to change notification settings - Fork 269
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
Modify response to have via
and server
headers
#1033
base: main
Are you sure you want to change the base?
Conversation
@aryan9600 What do you think about omitting the I think adding a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for working on this! i agree with @olix0r's comments about the via
header. also, i left a few suggestions about the server header inline.
linkerd/app/core/src/errors.rs
Outdated
@@ -218,11 +234,13 @@ impl<RspB: Default + hyper::body::HttpBody> respond::Respond<http::Response<RspB | |||
} | |||
|
|||
let status = http_status(&*error); | |||
const SERVER_HEADER: &'static str = concat!("linkerd-proxy/", env!("CARGO_PKG_VERSION")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't think it's really correct to use the cargo package version as the proxy's version. this is going to be the version of the linkerd-app-core
crate, which isn't the actual proxy version: https://github.com/aryan9600/linkerd2-proxy/blob/6438d0d19dafc22d6645d198b566085c7c5d0e73/linkerd/app/core/Cargo.toml#L3
instead, we should probably use the GIT_VERSION
env var, which is the current proxy version git tag, set by the build script:
linkerd2-proxy/linkerd/app/core/build.rs
Lines 24 to 27 in 1223447
set_env( | |
"GIT_VERSION", | |
Command::new("git").args(&["describe", "--always", "HEAD"]), | |
); |
const SERVER_HEADER: &'static str = concat!("linkerd-proxy/", env!("CARGO_PKG_VERSION")); | |
const SERVER_HEADER: &'static str = concat!("linkerd-proxy/", env!("GIT_VERSION")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the linting checks on CI are failing because the clippy
linter doesn't like the explicit 'static
lifetime here (constants always have the 'static
lifetime). to get CI passing, we should probably remove it:
const SERVER_HEADER: &'static str = concat!("linkerd-proxy/", env!("CARGO_PKG_VERSION")); | |
const SERVER_HEADER: &str = concat!("linkerd-proxy/", env!("CARGO_PKG_VERSION")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, forgot to consult clippy before pushing 😅
Signed-off-by: Sanskar Jaiswal <[email protected]>
6438d0d
to
9ce57f5
Compare
This PR addresses linkerd/linkerd2#2295.
I am not very confident about this PR, hence the draft PR.
Also, a rather peculiar thing, checking the response via the viz dashboard doesn't show the
via
orserver
header, but the debug statements do confirm that the response has been modified. It'd be great if I could get some feedback on how to improve this.