-
Notifications
You must be signed in to change notification settings - Fork 670
Use HeaderBlacklist to filter unwated headers in reverse proxy #6044
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
Use HeaderBlacklist to filter unwated headers in reverse proxy #6044
Conversation
jhadvig
left a comment
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.
/lgtm
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: akashshinde, jhadvig The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
| reverseProxy.FlushInterval = time.Millisecond * 100 | ||
| reverseProxy.Transport = transport | ||
| reverseProxy.ModifyResponse = filterHeaders | ||
| reverseProxy.ModifyResponse = func(r *http.Response) error { |
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.
HeaderBlacklist is intended to remove request headers, not response headers.
|
/lgtm cancel |
|
It looks like we have the request headers hard-coded here, so we're not sending anything we shouldn't. Maybe we can remove the |
|
@akashshinde Do you have a need to filter additional response headers or did you just notice it was unused? |
|
@spadgett |
Please check https://github.com/spadgett/console/blob/bc9a54150429b081278e2024fb6cb769f5ca3a86/cmd/bridge/main.go#L328 So I'm guessing we should remove hard coded headers and keep the field |
Right these are definitely request headers, not response headers.
But this was intended to filter request headers. I would rather have the hard-coded list to be honest since we should never send these for security reasons. It would be too easy to forget to set that on one of our proxies. Do you have a specific need to filter a different response header? |
this is the reason - #6044 (comment) |
|
I'd make this |
|
The problem though is that removing |
|
Any chance of fixing the Cache-Control header in the upstream service if it shouldn't be cached? |
https://redhat-developer.github.io/redhat-helm-charts/index.yaml this is the URL we are serving through the proxy and it's being served through GitHub pages. I doubt If we could remove/configure http headers in GitHub service @sbose78 wdyt?
Well I was thinking of replacing
|
|
@akashshinde If GitHub pages is setting a valid ETag on the response, why is the Cache-Control header a problem? You should get the cached version only when the ETag hasn't changed. |
|
Yea, let's close this PR. |
This PR provides a way to delete unwated headers from proxy response.
Proxy.Configalready has a field(HeaderBlacklist) to blacklist/filter headers, but It is not currently used anywhere. ref:console/pkg/proxy/proxy.go
Line 23 in ca7021b
This PR deletes headers provided in the
HeaderBlacklist