1

I have a magento2 web application which I need to enable maintenance mode excluding a specific IP. The following command did enable the maintenance mode without excluding my IP.

php bin/magento maintenance:enable --ip=123.45.67.89

and I tried the following since the above command didn't work.

php bin/magento maintenance:allow-ips 123.45.67.89

var/.maintenance.ip does exist and it has my ip listed in it.

2

Are you by any chance using varnish or another reverse proxy? ie, it might be that your public IP does not get forwarded, and therefore cannot be recognised. Easiest check is the access logs on the webserver, see if you can see your own IP in there. Otherwise you'll have to implemented x-forwarded-for headers

  • Thanks, @marcel-dumont. I am using CloudFlare. How do you suggest I expose my IP to my Magento application which is hosted on EC2? I have zero knowledge when it comes to this stuff. – TA3 Jun 18 '17 at 6:12
  • Have a look at support.cloudflare.com/hc/en-us/articles/… – Marcel Dumont Jun 18 '17 at 6:52
0

I can exclude ips from maintenance mode, by give below steps

1- php bin/magento maintenance:allow-ips MY_IP_ADDRESS

2- php bin/magento maintenance:enable

After running these two commands, I can see the maintenance mode is not enable for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.