diff --git a/src/Asset/CssCollectionRenderer.php b/src/Asset/CssCollectionRenderer.php
index ef4e7c1..08a2a91 100644
--- a/src/Asset/CssCollectionRenderer.php
+++ b/src/Asset/CssCollectionRenderer.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\http2_server_push\Asset;
 
+use Drupal;
 use Drupal\Core\Asset\AssetCollectionRendererInterface;
 use Symfony\Component\HttpFoundation\RequestStack;
 
@@ -48,30 +49,33 @@ class CssCollectionRenderer implements AssetCollectionRendererInterface {
   public function render(array $css_assets) {
     $elements = $this->cssCollectionRenderer->render($css_assets);
 
-    $request = $this->requestStack->getCurrentRequest();
-    $link_headers = $request->attributes->get('http2_server_push_link_headers', []);
-    foreach ($elements as &$element) {
-      if (!static::isLinkRelStylesheet($element)) {
-        continue;
-      }
+    if (Drupal::config('system.performance')->get('css.preprocess')) {
+      $request = $this->requestStack->getCurrentRequest();
+      $link_headers = $request->attributes->get('http2_server_push_link_headers', []);
+      foreach ($elements as &$element) {
+        if (!static::isLinkRelStylesheet($element)) {
+          continue;
+        }
 
-      // Locally served CSS files that are sent to all browsers can be pushed.
-      if (isset($element['#attributes']['href']) && static::hasRootRelativeUrl($element, 'href') && static::isUnconditional($element)) {
-        $link_header_value = '<' . $element['#attributes']['href'] . '>; rel=preload; as=style';
-        $link_headers[] = $link_header_value;
+        // Locally served CSS files that are sent to all browsers can be pushed.
+        if (isset($element['#attributes']['href']) && static::hasRootRelativeUrl($element, 'href') && static::isUnconditional($element)) {
+          $link_header_value = '<' . $element['#attributes']['href'] . '>; rel=preload; as=style';
+          $link_headers[] = $link_header_value;
 
-        // @todo When this is moved into Drupal core, consider allowing bubbling
-        // of bubbleable metadata from the return value of
-        // \Drupal\Core\Render\HtmlResponseAttachmentsProcessor::processAssetLibraries
-        // so this line of code can work, which would mean we would no longer
-        // need to use request attributes. (The problem is that a key assumption
-        // is that rendering set of asset libraries to HTML that loads CSS/JS,
-        // no further attachment bubbling happens. That's a fine assumption, but
-        // this module is the first and sole exception.)
-        //$element['#attached']['http_header'][] = ['Link', $link_header_value];
+          // @todo When this is moved into Drupal core, consider allowing bubbling
+          // of bubbleable metadata from the return value of
+          // \Drupal\Core\Render\HtmlResponseAttachmentsProcessor::processAssetLibraries
+          // so this line of code can work, which would mean we would no longer
+          // need to use request attributes. (The problem is that a key assumption
+          // is that rendering set of asset libraries to HTML that loads CSS/JS,
+          // no further attachment bubbling happens. That's a fine assumption, but
+          // this module is the first and sole exception.)
+          //$element['#attached']['http_header'][] = ['Link', $link_header_value];
+        }
       }
+      $request->attributes->set('http2_server_push_link_headers', $link_headers);
     }
-    $request->attributes->set('http2_server_push_link_headers', $link_headers);
+
     return $elements;
   }
 
diff --git a/src/Asset/JsCollectionRenderer.php b/src/Asset/JsCollectionRenderer.php
index f9525a1..ed5ba0d 100644
--- a/src/Asset/JsCollectionRenderer.php
+++ b/src/Asset/JsCollectionRenderer.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\http2_server_push\Asset;
 
+use Drupal;
 use Drupal\Core\Asset\AssetCollectionRendererInterface;
 use Symfony\Component\HttpFoundation\RequestStack;
 
@@ -48,30 +49,33 @@ class JsCollectionRenderer implements AssetCollectionRendererInterface {
   public function render(array $js_assets) {
     $elements = $this->jsCollectionRenderer->render($js_assets);
 
-    $request = $this->requestStack->getCurrentRequest();
-    $link_headers = $request->attributes->get('http2_server_push_link_headers', []);
-    foreach ($elements as &$element) {
-      if (!static::isScript($element)) {
-        continue;
-      }
+    if (Drupal::config('system.performance')->get('js.preprocess')) {
+      $request = $this->requestStack->getCurrentRequest();
+      $link_headers = $request->attributes->get('http2_server_push_link_headers', []);
+      foreach ($elements as &$element) {
+        if (!static::isScript($element)) {
+          continue;
+        }
 
-      // Locally served JS files that are sent to all browsers can be pushed.
-      if (isset($element['#attributes']['src']) && static::hasRootRelativeUrl($element, 'src') && static::isUnconditional($element)) {
-        $link_header_value = '<' . $element['#attributes']['src'] . '>; rel=preload; as=script';
-        $link_headers[] = $link_header_value;
+        // Locally served JS files that are sent to all browsers can be pushed.
+        if (isset($element['#attributes']['src']) && static::hasRootRelativeUrl($element, 'src') && static::isUnconditional($element)) {
+          $link_header_value = '<' . $element['#attributes']['src'] . '>; rel=preload; as=script';
+          $link_headers[] = $link_header_value;
 
-        // @todo When this is moved into Drupal core, consider allowing bubbling
-        // of bubbleable metadata from the return value of
-        // \Drupal\Core\Render\HtmlResponseAttachmentsProcessor::processAssetLibraries
-        // so this line of code can work, which would mean we would no longer
-        // need to use request attributes. (The problem is that a key assumption
-        // is that rendering set of asset libraries to HTML that loads CSS/JS,
-        // no further attachment bubbling happens. That's a fine assumption, but
-        // this module is the first and sole exception.)
-        //$element['#attached']['http_header'][] = ['Link', $link_header_value];
+          // @todo When this is moved into Drupal core, consider allowing bubbling
+          // of bubbleable metadata from the return value of
+          // \Drupal\Core\Render\HtmlResponseAttachmentsProcessor::processAssetLibraries
+          // so this line of code can work, which would mean we would no longer
+          // need to use request attributes. (The problem is that a key assumption
+          // is that rendering set of asset libraries to HTML that loads CSS/JS,
+          // no further attachment bubbling happens. That's a fine assumption, but
+          // this module is the first and sole exception.)
+          //$element['#attached']['http_header'][] = ['Link', $link_header_value];
+        }
       }
+      $request->attributes->set('http2_server_push_link_headers', $link_headers);
     }
-    $request->attributes->set('http2_server_push_link_headers', $link_headers);
+
     return $elements;
   }
 
