Skip to content

Commit

Permalink
Merge pull request #395 from interactiv4/feature/M095M01A-31
Browse files Browse the repository at this point in the history
feature/M095M01A-31 [MAGENTO 2] Make sure users on the maintenance li…
  • Loading branch information
vvuksan authored Jul 31, 2020
2 parents fb111c2 + 812788d commit a7eec88
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Model/FrontControllerPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,12 @@ public function aroundDispatch(FrontControllerInterface $subject, callable $proc
*/
private function sensitivePathProtection($path)
{
$ip = $this->request->getServerValue('HTTP_FASTLY_CLIENT_IP') ?? $this->request->getClientIp();

if ($this->readMaintenanceIp($ip)) {
return false;
}

$limitedPaths = json_decode($this->config->getRateLimitPaths());
if (!$limitedPaths) {
$limitedPaths = [];
Expand All @@ -163,7 +169,6 @@ private function sensitivePathProtection($path)
if ($limit) {
$rateLimitingLimit = $this->config->getRateLimitingLimit();
$rateLimitingTtl = $this->config->getRateLimitingTtl();
$ip = $this->request->getServerValue('HTTP_FASTLY_CLIENT_IP') ?? $this->request->getClientIp();
$tag = self::FASTLY_CACHE_TAG . $ip;
$data = json_decode($this->cache->load($tag), true);

Expand Down Expand Up @@ -339,7 +344,7 @@ private function readMaintenanceIp($ip)

private function log($message)
{
if($this->config->isRateLimitingLoggingEnabled()) {
if ($this->config->isRateLimitingLoggingEnabled()) {
$this->logger->info($message);
}
}
Expand Down

0 comments on commit a7eec88

Please sign in to comment.