diff --git a/tests/PHPUnit/Fixtures/UITestFixture.php b/tests/PHPUnit/Fixtures/UITestFixture.php
index 1e9543eb04d341953e2cb988bc1535a9428d13cb..b9f91a13cf91b1f243e559f2059e3fc2e0e9c102 100644
--- a/tests/PHPUnit/Fixtures/UITestFixture.php
+++ b/tests/PHPUnit/Fixtures/UITestFixture.php
@@ -330,4 +330,22 @@ class UITestFixture extends SqlDump
         APISegmentEditor::getInstance()->add(
             "Multiple actions", "actions>=2", $idSite = 1, $autoArchive = false, $enabledAllUsers = true);
     }
+
+    public function provideContainerConfig()
+    {
+        if (isset($_SERVER['HTTP_HOST'])) {
+            // phantomjs sends the port in HTTP_HOST which causes some UI tests to fail. so if it's present, we remove it here.
+            $_SERVER['HTTP_HOST'] = $this->removePortIfPresent($_SERVER['HTTP_HOST']);
+        }
+
+        return array();
+    }
+
+    private function removePortIfPresent($host)
+    {
+        if (preg_match("/(.*[^:]):[0-9]+/", $host, $matches)) {
+            return $matches[1];
+        }
+        return $host;
+    }
 }