 core/modules/rest/rest.services.yml                |  4 +++
 .../src/EventSubscriber/RestRouteSubscriber.php    | 40 ++++++++++++++++++++++
 .../EntityResource/EntityResourceTestBase.php      |  6 ++++
 3 files changed, 50 insertions(+)

diff --git a/core/modules/rest/rest.services.yml b/core/modules/rest/rest.services.yml
index 869eb19..ebed915 100644
--- a/core/modules/rest/rest.services.yml
+++ b/core/modules/rest/rest.services.yml
@@ -31,3 +31,7 @@ services:
     arguments: ['@router.builder']
     tags:
       - { name: event_subscriber }
+  rest.route_subscriber:
+    class: Drupal\rest\EventSubscriber\RestRouteSubscriber
+    tags:
+      - { name: event_subscriber }
diff --git a/core/modules/rest/src/EventSubscriber/RestRouteSubscriber.php b/core/modules/rest/src/EventSubscriber/RestRouteSubscriber.php
new file mode 100644
index 0000000..bd81370
--- /dev/null
+++ b/core/modules/rest/src/EventSubscriber/RestRouteSubscriber.php
@@ -0,0 +1,40 @@
+<?php
+
+namespace Drupal\rest\EventSubscriber;
+
+use Drupal\Core\Routing\RouteSubscriberBase;
+use Drupal\Core\Routing\RoutingEvents;
+use Symfony\Component\Routing\RouteCollection;
+
+/**
+ * Performs certain alterations to REST routes.
+ */
+class RestRouteSubscriber extends RouteSubscriberBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function alterRoutes(RouteCollection $collection) {
+    foreach ($collection->all() as $name => $route) {
+      // Removes the '_admin_route' route option from each REST route that had
+      // it added by \Drupal\system\EventSubscriber\AdminRouteSubscriber.
+      if (strpos($name, 'rest.') === 0 && $route->hasOption('_admin_route')) {
+        $route->setOption('_admin_route', FALSE);
+      }
+    }
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function getSubscribedEvents() {
+    $events = parent::getSubscribedEvents();
+
+    // Use a very low priority to run as late as possible. Especially use a
+    // lower priority than \Drupal\system\EventSubscriber\AdminRouteSubscriber.
+    $events[RoutingEvents::ALTER] = ['onAlterRoutes', -1000];
+
+    return $events;
+  }
+
+}
diff --git a/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php b/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php
index 53796c8..490d6a1 100644
--- a/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php
+++ b/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php
@@ -386,6 +386,8 @@ public function testGet() {
     // 200 for well-formed HEAD request.
     $response = $this->request('HEAD', $url, $request_options);
     $this->assertResourceResponse(200, '', $response);
+    $this->assertTrue($response->hasHeader('X-Drupal-Dynamic-Cache'));
+    $this->assertSame(['MISS'], $response->getHeader('X-Drupal-Dynamic-Cache'));
     if (!$this->account) {
       $this->assertSame(['MISS'], $response->getHeader('X-Drupal-Cache'));
     }
@@ -395,13 +397,17 @@ public function testGet() {
     $head_headers = $response->getHeaders();
 
     // 200 for well-formed GET request. Page Cache hit because of HEAD request.
+    // Same for Dynamic Page Cache hit.
     $response = $this->request('GET', $url, $request_options);
     $this->assertResourceResponse(200, FALSE, $response);
+    $this->assertTrue($response->hasHeader('X-Drupal-Dynamic-Cache'));
     if (!static::$auth) {
       $this->assertSame(['HIT'], $response->getHeader('X-Drupal-Cache'));
+      $this->assertSame(['MISS'], $response->getHeader('X-Drupal-Dynamic-Cache'));
     }
     else {
       $this->assertFalse($response->hasHeader('X-Drupal-Cache'));
+      $this->assertSame(['HIT'], $response->getHeader('X-Drupal-Dynamic-Cache'));
     }
     $cache_tags_header_value = $response->getHeader('X-Drupal-Cache-Tags')[0];
     $this->assertEquals($this->getExpectedCacheTags(), empty($cache_tags_header_value) ? [] : explode(' ', $cache_tags_header_value));
