diff --git a/tests/data/test503 b/tests/data/test503
index b9f093f3549f39d07913db8966d53f1354d2b2f0..2189054e94cc1bdc43aa314bf28115f524db5bdf 100644
--- a/tests/data/test503
+++ b/tests/data/test503
@@ -34,7 +34,7 @@ lib503
simple multi http:// through proxytunnel with authentication info
-http://%HOSTIP:%HTTPSPORT/503 localhost:%HTTPPORT
+http://%HOSTIP:%HTTPSPORT/503 127.0.0.1:%HTTPPORT
foo
diff --git a/tests/data/test504 b/tests/data/test504
index f2a86412394a3cd2140bfd144649e9eeda9ca58b..32cff5f71e0e2d8b49478bbc8b2bcf768d24ecb7 100644
--- a/tests/data/test504
+++ b/tests/data/test504
@@ -16,7 +16,7 @@ lib504
simple multi through local proxy without listener
-http://%HOSTIP:%HTTPSPORT/504 localhost:55555
+http://%HOSTIP:%HTTPSPORT/504 127.0.0.1:55555
diff --git a/tests/data/test509 b/tests/data/test509
index 70ce7c183813cb432219dd5b933f988fb32be463..06f3aab4bc0e986720c2fb7c4be88ad444aa720b 100644
--- a/tests/data/test509
+++ b/tests/data/test509
@@ -30,7 +30,7 @@ lib509
simple HTTPS GET and URL redirect in certificate
-https://localhost:%HTTPSPORT/dvcs %HTTPSPORT
+https://127.0.0.1:%HTTPSPORT/dvcs %HTTPSPORT
@@ -42,7 +42,7 @@ https://localhost:%HTTPSPORT/dvcs %HTTPSPORT
GET /509 HTTP/1.1
-Host: localhost:%HTTPSPORT
+Host: 127.0.0.1:%HTTPSPORT
Pragma: no-cache
Accept: */*
diff --git a/tests/libtest/lib509.c b/tests/libtest/lib509.c
index 9e535e9b68c625db6133c5c6f38e3113321f8c20..d20c31524270ee37f63e045320c504be67ebeafb 100644
--- a/tests/libtest/lib509.c
+++ b/tests/libtest/lib509.c
@@ -121,7 +121,7 @@ static int ssl_app_verify_callback(X509_STORE_CTX *ctx, void *arg)
URL in the cert uses a static one. We thus need to create a new
URL that uses the currently requested port number which may not
be the one this URL uses! */
- sprintf(newurl, "https://localhost:%d/509", portnum);
+ sprintf(newurl, "https://127.0.0.1:%d/509", portnum);
fprintf(stderr, "But *really* Setting URL <%s>\n", newurl);
curl_easy_setopt(p->curl, CURLOPT_URL, newurl);