diff --git a/webprofiler/src/RequestMatcher/WebprofilerRequestMatcher.php b/webprofiler/src/RequestMatcher/WebprofilerRequestMatcher.php
index 17087cc..07fcfd2 100644
--- a/webprofiler/src/RequestMatcher/WebprofilerRequestMatcher.php
+++ b/webprofiler/src/RequestMatcher/WebprofilerRequestMatcher.php
@@ -3,6 +3,7 @@
 namespace Drupal\webprofiler\RequestMatcher;

 use Drupal\Core\Config\ConfigFactoryInterface;
+use Drupal\Core\Path\CurrentPathStack;
 use Drupal\Core\Path\PathMatcherInterface;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpFoundation\RequestMatcherInterface;
@@ -24,10 +25,12 @@ class WebprofilerRequestMatcher implements RequestMatcherInterface {

   /**
    * @param ConfigFactoryInterface $configFactory
+   * @param \Drupal\Core\Path\CurrentPathStack $currentPath
    * @param \Drupal\Core\Path\PathMatcherInterface $pathMatcher
    */
-  public function __construct(ConfigFactoryInterface $configFactory, PathMatcherInterface $pathMatcher) {
+  public function __construct(ConfigFactoryInterface $configFactory, CurrentPathStack $currentPath, PathMatcherInterface $pathMatcher) {
     $this->configFactory = $configFactory;
+    $this->currentPath = $currentPath;
     $this->pathMatcher = $pathMatcher;
   }

@@ -35,7 +38,7 @@ class WebprofilerRequestMatcher implements RequestMatcherInterface {
    * {@inheritdoc}
    */
   public function matches(Request $request) {
-    $path = $request->getPathInfo();
+    $path = $this->currentPath->getPath();

     $patterns = $this->configFactory->get('webprofiler.config')->get('exclude');

diff --git a/webprofiler/webprofiler.services.yml b/webprofiler/webprofiler.services.yml
index 5052792..a301a4a 100644
--- a/webprofiler/webprofiler.services.yml
+++ b/webprofiler/webprofiler.services.yml
@@ -42,7 +42,7 @@ services:
 # request matcher
   webprofiler.matcher:
     class: Drupal\webprofiler\RequestMatcher\WebprofilerRequestMatcher
-    arguments: ['@config.factory', '@path.matcher']
+    arguments: ['@config.factory', '@path.current', '@path.matcher']

 # event subscribers
   webprofiler.profiler_listener:
