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

interceptor: don't override Host header #746

Merged
merged 1 commit into from
Jul 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ This changelog keeps track of work items that have been completed and are ready
- **Operator**: Remove ScaledObject `name` & `app` custom labels ([#717](https://github.com/kedacore/http-add-on/issues/717))
- **Interceptor**: fatal error: concurrent map iteration and map write ([#726](https://github.com/kedacore/http-add-on/issues/726))
- **Interceptor**: Provide graceful shutdown for http servers on SIGINT and SIGTERM ([#731](https://github.com/kedacore/http-add-on/issues/731))
- **Interceptor**: Keep original Host in the Host header ([#731](https://github.com/kedacore/http-add-on/issues/331))
- **Scaler**: Provide graceful shutdown for grpc server on SIGINT and SIGTERM ([#731](https://github.com/kedacore/http-add-on/issues/731))

### Deprecations
Expand Down
3 changes: 2 additions & 1 deletion interceptor/handler/upstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ func (uh *Upstream) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}

proxy := httputil.NewSingleHostReverseProxy(stream)
superDirector := proxy.Director
proxy.Transport = uh.roundTripper
proxy.Director = func(req *http.Request) {
superDirector(req)
req.URL = stream
req.Host = stream.Host
req.URL.Path = r.URL.Path
req.URL.RawQuery = r.URL.RawQuery
// delete the incoming X-Forwarded-For header so the proxy
Expand Down
Loading