Change:
Hello there, I did search around and didn't find a report for this already, I hope it's not a dupe. What happened: In an HTTP probe definition (readyness or liveness), the custom host header is not set properly after a redirect occurs. What you expected to happen: Seeing that states that redirects are weird but allowed, I would expect the custom headers to be maintained after the redirect occurs. How to reproduce it (as minimally and precisely as possible): Setup an HTTP service that expects a specific Host header to be used (using Django here) and would return a 400 if the Host doesn't match (for a more detail view at how Django deals with this ). Then setup a probe like: You should now see in your logs that the first call to the service succeeded with a 301 (or 3XX) which means the Host header was set properly, but that the call to the redirected url will fail with a 400 which means the Host header was not set anymore and makes the probe raise an error. Anything else we need to know?: In the above test, setting the "path" to the redirected url works and the probe is green. Environment: Kubernetes version (use ):Cloud provider or hardware configuration: intel NUC OS (e.g. from /etc/os-release): Ubuntu 16.04.5 LTS Kernel (e.g. ): Linux nuc 4.4.0-138-generic -Ubuntu SMP Tue Oct 2 17:16:02 UTC 2018 x8664 x8664 x86_64 GNU/Linux Install tools: Minikube Others: <!-- DO NOT EDIT BELOW THIS LINE --/kind bug
/sig node /sig network
We are calling Go's HTTP client here - is it possible that this is "normal" behavior for Go? I don't know...
Seems like an old bug indeed: - not sure where to go from there...
want to try attempting a patch using ? code that mentioned is in
I can definitely try to submit a PR with that change! Thanks for pointing in the right direction
I just tested this on GKE and also have a unit test confirming that this is not an issue anymore, I guess HTTP go client has been fixed.
Awesome! looks like losing track of my commitment here was a good investment thx for the feedback !
Awesome. Looking forward to more tests :)

Discussion:
}) } } <ins> func TestHTTPProbeChecker_HostHeaderPreservedAfterRedirect(t *testing.T) { successHostHeader := "www.success.com" failHostHeader := "www.fail.com" handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { switch r.URL.Path { case "/redirect": http.Redirect(w, r, "/success", http.StatusFound) case "/success": if r.Host == successHostHeader { w.WriteHeader(http.StatusOK) } else { http.Error(w, "", http.StatusBadRequest) } default: http.Error(w, "", http.StatusInternalServerError) } }) server := httptest.NewServer(handler) defer server.Close() testCases := map[string]struct { hostHeader     string expectedResult probe.Result }{ "success": {successHostHeader, probe.Success}, "fail":    {failHostHeader, probe.Failure}, } for desc, test := range testCases { headers := http.Header{} headers.Add("Host", test.hostHeader) t.Run(desc+"local", func(t *testing.T) { followNonLocalRedirects := false prober := New(followNonLocalRedirects) target, err := url.Parse(server.URL + "/redirect") require.NoError(t, err) result, _, _ := prober.Probe(target, headers, wait.ForeverTestTimeout) assert.Equal(t, test.expectedResult, result) }) t.Run(desc+"nonlocal", func(t *testing.T) { followNonLocalRedirects := true prober := New(followNonLocalRedirects) target, err := url.Parse(server.URL + "/redirect") require.NoError(t, err) result, _, _ := prober.Probe(target, headers, wait.ForeverTestTimeout) assert.Equal(t, test.expectedResult, result) }) } } </ins>