diff --git a/src/CasRedirectData.php b/src/CasRedirectData.php
index 960ea8d..7a63eab 100644
--- a/src/CasRedirectData.php
+++ b/src/CasRedirectData.php
@@ -45,9 +45,14 @@ class CasRedirectData {
   /**
    * Cache contexts to apply to cacheable redirect responses.
    *
+   * We need to vary the redirect response based on the URL because:
+   * 1. The site domain is included in the service parameter in the redirect.
+   * 2. Paramters on the URL are passed along as query params to the service
+   * URL as well.
+   *
    * @var array
    */
-  protected $cacheContexts = ['url.site'];
+  protected $cacheContexts = ['url'];
 
   /**
    * CasRedirectData constructor.
diff --git a/tests/src/Functional/CasForcedLoginControllerTest.php b/tests/src/Functional/CasForcedLoginControllerTest.php
index 7086939..5195bd7 100644
--- a/tests/src/Functional/CasForcedLoginControllerTest.php
+++ b/tests/src/Functional/CasForcedLoginControllerTest.php
@@ -14,18 +14,12 @@ class CasForcedLoginControllerTest extends CasBrowserTestBase {
   /**
    * {@inheritdoc}
    */
-  public static $modules = ['cas'];
+  public static $modules = ['cas', 'page_cache', 'dynamic_page_cache'];
 
   /**
    * Tests the the forced login route that redirects users authenticate.
-   *
-   * @param array $params
-   *   Testing parameters.
-   *
-   * @dataProvider queryStringDataProvider
-   *   Data provider
    */
-  public function testForcedLoginRoute(array $params = []) {
+  public function testForcedLoginRoute() {
     $admin = $this->drupalCreateUser(['administer account settings']);
     $this->drupalLogin($admin);
 
@@ -44,26 +38,20 @@ class CasForcedLoginControllerTest extends CasBrowserTestBase {
     // We want to test that query string parameters that are present on the
     // request to the forced login route are passed along to the service
     // URL as well, so test each of these cases individually.
-    $path = $this->buildUrl('cas', ['query' => $params, 'absolute' => TRUE]);
-
-    $session->visit($path);
+    $params_to_test = [
+      [],
+      ['returnto' => 'node/1'],
+      ['foo' => 'bar', 'buzz' => 'baz'],
+    ];
+    foreach ($params_to_test as $params) {
+      $path = $this->buildUrl('cas', ['query' => $params, 'absolute' => TRUE]);
 
-    $this->assertEquals(302, $session->getStatusCode());
-    $expected_redirect_location = 'https://fakecasserver.localhost/auth/login?' . UrlHelper::buildQuery(['service' => $this->buildServiceUrlWithParams($params)]);
-    $this->assertEquals($expected_redirect_location, $session->getResponseHeader('Location'));
-  }
+      $session->visit($path);
 
-  /**
-   * Data provider for testForcedLoginRoute.
-   *
-   * Provides various different query strings to the forced login route.
-   */
-  public function queryStringDataProvider() {
-    return [
-      [[]],
-      [['returnto' => 'node/1']],
-      [['foo' => 'bar', 'buzz' => 'baz']],
-    ];
+      $this->assertEquals(302, $session->getStatusCode());
+      $expected_redirect_location = 'https://fakecasserver.localhost/auth/login?' . UrlHelper::buildQuery(['service' => $this->buildServiceUrlWithParams($params)]);
+      $this->assertEquals($expected_redirect_location, $session->getResponseHeader('Location'));
+    }
   }
 
 }
diff --git a/tests/src/Functional/CasLoginFormTest.php b/tests/src/Functional/CasLoginFormTest.php
index 0985fc7..774e800 100644
--- a/tests/src/Functional/CasLoginFormTest.php
+++ b/tests/src/Functional/CasLoginFormTest.php
@@ -14,7 +14,7 @@ class CasLoginFormTest extends BrowserTestBase {
   /**
    * {@inheritdoc}
    */
-  public static $modules = ['cas'];
+  public static $modules = ['cas', 'page_cache', 'dynamic_page_cache'];
 
   /**
    * Tests the login link on the user login form.
diff --git a/tests/src/Functional/CasSubscriberTest.php b/tests/src/Functional/CasSubscriberTest.php
index e32e58d..0ac56cb 100644
--- a/tests/src/Functional/CasSubscriberTest.php
+++ b/tests/src/Functional/CasSubscriberTest.php
@@ -14,7 +14,14 @@ class CasSubscriberTest extends CasBrowserTestBase {
   /**
    * {@inheritdoc}
    */
-  public static $modules = ['cas', 'path', 'filter', 'node'];
+  public static $modules = [
+    'cas',
+    'path',
+    'filter',
+    'node',
+    'page_cache',
+    'dynamic_page_cache',
+  ];
 
   /**
    * Test that the CasSubscriber properly forces CAS authentication as expected.
diff --git a/tests/src/Functional/CasUserFormFieldTest.php b/tests/src/Functional/CasUserFormFieldTest.php
index 8e10155..dd18b2c 100644
--- a/tests/src/Functional/CasUserFormFieldTest.php
+++ b/tests/src/Functional/CasUserFormFieldTest.php
@@ -12,7 +12,7 @@ class CasAccountAndRegistrationFormTest extends CasBrowserTestBase {
   /**
    * {@inheritdoc}
    */
-  public static $modules = ['cas'];
+  public static $modules = ['cas', 'page_cache', 'dynamic_page_cache'];
 
   /**
    * Tests that the CAS username field works as expected.
