@@ -16,14 +16,7 @@ func (f *fakeResponder) Error(w http.ResponseWriter, _ *http.Request, err error)
1616 http .Error (w , err .Error (), http .StatusInternalServerError )
1717}
1818
19- // TestHandlerWithErrorResponder_UseLocationHost verifies that UseLocationHost=true causes
20- // the UpgradeAwareHandler to send the backend hostname as the Host header, not the
21- // original client Host header.
22- //
23- // On clusters where the API server is fronted by an Istio proxy (e.g. Gardener shoots),
24- // Istio enforces virtual host routing and returns 404 for any Host value it does not
25- // recognise. Without this fix, kubectl logs/exec/port-forward fail because the handler
26- // forwards the vcluster LB hostname instead of the actual API server hostname.
19+ // TestHandlerWithErrorResponder_UseLocationHost verifies that the backend receives the correct Host header, not the client's vcluster LB hostname.
2720func TestHandlerWithErrorResponder_UseLocationHost (t * testing.T ) {
2821 var receivedHost string
2922 backend := httptest .NewTLSServer (http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
@@ -43,7 +36,7 @@ func TestHandlerWithErrorResponder_UseLocationHost(t *testing.T) {
4336 // Simulate a client request with a vcluster LB hostname as Host —
4437 // this is what the UpgradeAwareHandler used to forward before the fix.
4538 req := httptest .NewRequest (http .MethodGet , "/api/v1/namespaces/default/pods/test/log" , nil )
46- req .Host = "vcluster-lb.us-west-2.elb.amazonaws .com"
39+ req .Host = "vcluster.example .com"
4740
4841 h .ServeHTTP (httptest .NewRecorder (), req )
4942
0 commit comments