diff --git a/src/Plugin/RulesAction/BanIP.php b/src/Plugin/RulesAction/BanIP.php
index bf54cc4..57f9ff4 100644
--- a/src/Plugin/RulesAction/BanIP.php
+++ b/src/Plugin/RulesAction/BanIP.php
@@ -5,7 +5,7 @@ namespace Drupal\rules\Plugin\RulesAction;
 use Drupal\ban\BanIpManagerInterface;
 use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
 use Drupal\rules\Core\RulesActionBase;
-use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\HttpFoundation\RequestStack;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 
 /**
@@ -41,11 +41,11 @@ class BanIP extends RulesActionBase implements ContainerFactoryPluginInterface {
   protected $banManager;
 
   /**
-   * The corresponding request.
+   * The corresponding request stack.
    *
-   * @var \Symfony\Component\HttpFoundation\Request
+   * @var \Symfony\Component\HttpFoundation\RequestStack
    */
-  protected $request;
+  protected $requestStack;
 
   /**
    * {@inheritdoc}
@@ -56,7 +56,7 @@ class BanIP extends RulesActionBase implements ContainerFactoryPluginInterface {
       $plugin_id,
       $plugin_definition,
       $container->get('ban.ip_manager'),
-      $container->get('request')
+      $container->get('request_stack')
     );
   }
 
@@ -71,13 +71,13 @@ class BanIP extends RulesActionBase implements ContainerFactoryPluginInterface {
    *   The plugin implementation definition.
    * @param \Drupal\ban\BanIpManagerInterface $ban_manager
    *   The ban manager.
-   * @param \Symfony\Component\HttpFoundation\Request $request
-   *   The corresponding request.
+   * @param \Symfony\Component\HttpFoundation\RequestStack $request_stack
+   *   The corresponding request stack.
    */
-  public function __construct(array $configuration, $plugin_id, $plugin_definition, BanIpManagerInterface $ban_manager, Request $request) {
+  public function __construct(array $configuration, $plugin_id, $plugin_definition, BanIpManagerInterface $ban_manager, RequestStack $request_stack) {
     parent::__construct($configuration, $plugin_id, $plugin_definition);
     $this->banManager = $ban_manager;
-    $this->request = $request;
+    $this->requestStack = $request_stack;
   }
 
   /**
@@ -88,7 +88,7 @@ class BanIP extends RulesActionBase implements ContainerFactoryPluginInterface {
    */
   protected function doExecute($ip = NULL) {
     if (!isset($ip)) {
-      $ip = $this->request->getClientIp();
+      $ip = $this->requestStack->getCurrentRequest()->getClientIp();
     }
 
     $this->banManager->banIp($ip);
diff --git a/tests/src/Unit/Integration/Action/BanIPTest.php b/tests/src/Unit/Integration/Action/BanIPTest.php
index 4a7dd68..ad4297a 100644
--- a/tests/src/Unit/Integration/Action/BanIPTest.php
+++ b/tests/src/Unit/Integration/Action/BanIPTest.php
@@ -4,7 +4,7 @@ namespace Drupal\Tests\rules\Unit\Integration\Action;
 
 use Drupal\ban\BanIpManagerInterface;
 use Drupal\Tests\rules\Unit\Integration\RulesIntegrationTestBase;
-use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\HttpFoundation\RequestStack;
 
 /**
  * @coversDefaultClass \Drupal\rules\Plugin\RulesAction\BanIP
@@ -25,9 +25,9 @@ class BanIPTest extends RulesIntegrationTestBase {
   protected $banManager;
 
   /**
-   * @var \Symfony\Component\HttpFoundation\Request|\Prophecy\Prophecy\ProphecyInterface
+   * @var \Symfony\Component\HttpFoundation\RequestStack|\Prophecy\Prophecy\ProphecyInterface
    */
-  protected $request;
+  protected $requestStack;
 
   /**
    * {@inheritdoc}
@@ -39,8 +39,8 @@ class BanIPTest extends RulesIntegrationTestBase {
     $this->banManager = $this->prophesize(BanIpManagerInterface::class);
     $this->container->set('ban.ip_manager', $this->banManager->reveal());
 
-    $this->request = $this->prophesize(Request::class);
-    $this->container->set('request', $this->request->reveal());
+    $this->requestStack = $this->prophesize(RequestStack::class);
+    $this->container->set('request_stack', $this->requestStack->reveal());
 
     $this->action = $this->actionManager->createInstance('rules_ban_ip');
   }
@@ -111,12 +111,11 @@ class BanIPTest extends RulesIntegrationTestBase {
     // TEST-NET-1 IPv4.
     $ip = '192.0.2.0';
 
-    $this->request->getClientIp()->willReturn($ip)->shouldBeCalledTimes(1);
+    $this->requestStack->getCurrentRequest()->getClientIp()->willReturn($ip)->shouldBeCalledTimes(1);
 
     $this->banManager->banIp($ip)->shouldBeCalledTimes(1);
 
     $this->action->execute();
-
   }
 
 }
