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

Remove default User-Agent handling in NewHeaderPruningReverseProxy #15738

Open
kevinmingtarja opened this issue Jan 28, 2025 · 2 comments
Open
Labels
area/networking kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. kind/question Further information is requested triage/accepted Issues which should be fixed (post-triage)
Milestone

Comments

@kevinmingtarja
Copy link

kevinmingtarja commented Jan 28, 2025

/area networking
/kind cleanup

Ask your question here:

in NewHeaderPruningReverseProxy, we are checking whether the User-Agent is unset. If yes, we explicitly set it to "" so that it's not set to the default Go HTTP client User-Agent:

// Copied from httputil.NewSingleHostReverseProxy.
if _, ok := req.Header[netheader.UserAgentKey]; !ok {
// explicitly disable User-Agent so it's not set to default value
req.Header.Set(netheader.UserAgentKey, "")
}

but i think this is no longer necessary starting from golang/go@f001df5 (>= go1.20rc1), where this check was moved from httputil.NewSingleHostReverseProxy (where the Knative code was copied from, as noted from the comment) to ReverseProxy.ServeHTTP, so all instances of ReverseProxy will now have this behaviour.

so should we remove this conditional block?

@kevinmingtarja kevinmingtarja added the kind/question Further information is requested label Jan 28, 2025
@knative-prow knative-prow bot added area/networking kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. labels Jan 28, 2025
@dprotaso dprotaso added this to the v1.18 milestone Jan 28, 2025
@dprotaso
Copy link
Member

/triage accepted

Yeah we should drop if the go std lib does it for us

@knative-prow knative-prow bot added the triage/accepted Issues which should be fixed (post-triage) label Jan 28, 2025
@TusharMohapatra07
Copy link

Can i take up this issue ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/networking kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. kind/question Further information is requested triage/accepted Issues which should be fixed (post-triage)
Projects
None yet
Development

No branches or pull requests

3 participants