diff --git a/src/Plugin/rest/resource/CollectResource.php b/src/Plugin/rest/resource/CollectResource.php
index 2aa6d25..1666497 100644
--- a/src/Plugin/rest/resource/CollectResource.php
+++ b/src/Plugin/rest/resource/CollectResource.php
@@ -12,6 +12,7 @@ use Drupal\Core\Entity\EntityManagerInterface;
 use Drupal\Core\Entity\Query\QueryFactory;
 use Drupal\Core\Queue\QueueInterface;
 use Drupal\Core\Routing\UrlGeneratorInterface;
+use Drupal\Core\Url;
 use Drupal\rest\Plugin\ResourceBase;
 use Drupal\rest\ResourceResponse;
 use Psr\Log\LoggerInterface;
@@ -198,9 +199,12 @@ class CollectResource extends ResourceBase {
       ];
       $code = Response::HTTP_INTERNAL_SERVER_ERROR;
     }
-    return new ResourceResponse($data, $code, array(
-      'Location' => $this->getCanonicalUrl($container),
+    $url = $this->getCanonicalUrl($container);
+    $response = new ResourceResponse($data, $code, array(
+      'Location' => $url->getGeneratedUrl(),
     ));
+    $response->addCacheableDependency($url);
+    return $response;
   }
 
   /**
@@ -209,15 +213,15 @@ class CollectResource extends ResourceBase {
    * @param CollectContainerInterface $submission
    *   The submission object.
    *
-   * @return string
+   * @return \Drupal\Core\GeneratedUrl
    *   The canonical service url.
    *
    * @todo Make this work if the route for the json format is missing.
    */
   protected function getCanonicalUrl(CollectContainerInterface $submission) {
-    return $this->urlGenerator->generate('rest.collect.GET.json', array(
-      'uuid' => $submission->uuid(),
-    ), TRUE);
+    return Url::fromRoute('rest.collect.GET.json', array(
+      'uuid' => $submission->uuid()
+    ))->toString(TRUE);
   }
 
 }
