Magento2: Magneto 2 .maintenance.ip file is not working

Created on 18 Apr 2016  路  6Comments  路  Source: magento/magento2

.maintenance.flag is working fine but when I want to exempt my own machine ip, put the .maintenance.ip file in var with remote ip it's not working.

Ready for Work

Most helpful comment

Found the same issue.
Server config: SSL + Nginx + Varnish (that works as proxy for https/http)

Seems that this code doesn't allow all possible scenarios like proxy (HTTP_X_FORWARDED_FOR).

vendor/magento/framework/App/Bootstrap.php

        /** @var \Magento\Framework\App\MaintenanceMode $maintenance */
        $this->maintenance = $this->objectManager->get('Magento\Framework\App\MaintenanceMode');
        $isOn = $this->maintenance->isOn(isset($this->server['REMOTE_ADDR']) ? $this->server['REMOTE_ADDR'] : '');

All 6 comments

@inborntech thank you for reporting, we have created MAGETWO-52040 to investigate and fix.

Hi @inborntech

I wasn't able to reproduce this bug on latest develop branch with command like
php bin/magento maintenance:enable --ip=127.0.0.1

If you still can reproduce it or has additional info-please reopen current issue.
Closed.

Found the same issue.
Server config: SSL + Nginx + Varnish (that works as proxy for https/http)

Seems that this code doesn't allow all possible scenarios like proxy (HTTP_X_FORWARDED_FOR).

vendor/magento/framework/App/Bootstrap.php

        /** @var \Magento\Framework\App\MaintenanceMode $maintenance */
        $this->maintenance = $this->objectManager->get('Magento\Framework\App\MaintenanceMode');
        $isOn = $this->maintenance->isOn(isset($this->server['REMOTE_ADDR']) ? $this->server['REMOTE_ADDR'] : '');

@vkosenok please do not post on closed issues.

I know we should post on closed issues but i im experiencing the same issue as vkosenok, and i have pretty similar configuration SSL + Nginx + Varnish (that works as proxy for https/http) , Any solution?.

Sorry for the incovenience.

You can configure Nginx in order to add the real IP when there is Varnish

set_real_ip_from 127.0.0.1; #Put the Ip of your varnish/proxy here
real_ip_header X-Forwarded-For; #Put the Header that your varnish/proxy set

But I do not find a solution yet in order not to cache Varnish page for allowed IPs.

Was this page helpful?
0 / 5 - 0 ratings