providers/proxy: revert Host header behaviour
closes #2284 Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
df362dd9ea
commit
4915e980c5
|
@ -77,7 +77,6 @@ func (a *Application) proxyModifyRequest(ou *url.URL) func(req *http.Request) {
|
|||
claims, _ := a.getClaims(r)
|
||||
r.URL.Scheme = ou.Scheme
|
||||
r.URL.Host = ou.Host
|
||||
r.Host = ou.Host
|
||||
if claims != nil && claims.Proxy != nil && claims.Proxy.BackendOverride != "" {
|
||||
u, err := url.Parse(claims.Proxy.BackendOverride)
|
||||
if err != nil {
|
||||
|
@ -85,7 +84,6 @@ func (a *Application) proxyModifyRequest(ou *url.URL) func(req *http.Request) {
|
|||
} else {
|
||||
r.URL.Scheme = u.Scheme
|
||||
r.URL.Host = u.Host
|
||||
r.Host = u.Host
|
||||
}
|
||||
}
|
||||
a.log.WithField("upstream_url", r.URL.String()).Trace("final upstream url")
|
||||
|
|
|
@ -22,7 +22,7 @@ func TestProxy_ModifyRequest(t *testing.T) {
|
|||
assert.Equal(t, "frontend", req.Header.Get("X-Forwarded-Host"))
|
||||
assert.Equal(t, "/foo", req.URL.Path)
|
||||
assert.Equal(t, "backend:8012", req.URL.Host)
|
||||
assert.Equal(t, "backend:8012", req.Host)
|
||||
assert.Equal(t, "frontend", req.Host)
|
||||
}
|
||||
|
||||
func TestProxy_ModifyRequest_Claims(t *testing.T) {
|
||||
|
@ -50,7 +50,7 @@ func TestProxy_ModifyRequest_Claims(t *testing.T) {
|
|||
|
||||
assert.Equal(t, "/foo", req.URL.Path)
|
||||
assert.Equal(t, "other-backend:8123", req.URL.Host)
|
||||
assert.Equal(t, "other-backend:8123", req.Host)
|
||||
assert.Equal(t, "frontend", req.Host)
|
||||
}
|
||||
|
||||
func TestProxy_ModifyRequest_Claims_Invalid(t *testing.T) {
|
||||
|
@ -78,5 +78,5 @@ func TestProxy_ModifyRequest_Claims_Invalid(t *testing.T) {
|
|||
|
||||
assert.Equal(t, "/foo", req.URL.Path)
|
||||
assert.Equal(t, "backend:8012", req.URL.Host)
|
||||
assert.Equal(t, "backend:8012", req.Host)
|
||||
assert.Equal(t, "frontend", req.Host)
|
||||
}
|
||||
|
|
Reference in New Issue