Replace localhost with 127.0.0.1 to prevent DNS resolving problem (#1227)

This commit is contained in:
Ta-Ching Chen
2019-07-12 09:16:10 +08:00
committed by GitHub
parent c1cb9603a5
commit b0b29da388
+5 -2
View File
@@ -615,14 +615,17 @@ func (fetcher *Fetcher) SpecializePod(ctx context.Context, fetchReq types.Functi
return errors.Wrap(err, "error encoding load request")
}
// Instead of using "localhost", here we use "127.0.0.1" for
// inter-pod communication to prevent wrongly record returned from DNS.
if loadReq.EnvVersion >= 2 {
contentType = "application/json"
specializeURL = "http://localhost:8888/v2/specialize"
specializeURL = "http://127.0.0.1:8888/v2/specialize"
reader = bytes.NewReader(loadPayload)
fetcher.logger.Info("calling environment v2 specialization endpoint")
} else {
contentType = "text/plain"
specializeURL = "http://localhost:8888/specialize"
specializeURL = "http://127.0.0.1:8888/specialize"
reader = bytes.NewReader([]byte{})
fetcher.logger.Info("calling environment v1 specialization endpoint")
}