MAINTENANCE_MODE_IGNORE_IP_ADDRESSES does not work.
See original GitHub issueHow does “else: client_ip_address = get_client_ip_address_func(request)_” (1st one) work?
if settings.MAINTENANCE_MODE_IGNORE_IP_ADDRESSES:
if settings.MAINTENANCE_MODE_GET_CLIENT_IP_ADDRESS:
try:
get_client_ip_address_func = import_string(
settings.MAINTENANCE_MODE_GET_CLIENT_IP_ADDRESS)
except ImportError:
raise ImproperlyConfigured(
'settings.MAINTENANCE_MODE_GET_CLIENT_IP_ADDRESS '
'is not a valid function path.')
else:
client_ip_address = get_client_ip_address_func(request)_
else:
client_ip_address = get_client_ip_address(request)
for ip_address in settings.MAINTENANCE_MODE_IGNORE_IP_ADDRESSES:
ip_address_re = re.compile(ip_address)
if ip_address_re.match(client_ip_address):
return False
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Cannot enable Magento 2 maintenance mode excluding a ...
The typically maintenance mode will not work since your real IP is coming through as a forwarded IP due to the Haproxy/ Varnish...
Read more >Exempt maintenance ip not working · Issue #7596
After a clean install in magento 2.1.1 CE without sample data i've run into the issue that once i enabled and added an...
Read more >Skip-Maintenance-Mode-By-IP
It allows site administrators to set IP addresses that are allowed access to the website while in maintenance mode, without being logged in....
Read more >Exclude Multiple IPs From Showing Maintenance Mode
I am a web developer and work from multiple locations. I need to be able to exclude these IPs from showing the Maintenance...
Read more >How To Enable Or Disable Maintenance Mode In Magento 2
By using the above command, you can enable the maintenance mode for two IP addresses. The IP address of the developer who wants...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@fabiocaccamo I installed ipware and wrote MAINTENANCE_MODE_GET_CLIENT_IP_ADDRESS = ‘ipware.ip.get_ip’ right before MAINTENANCE_MODE_IGNORE_IP_ADDRESSES in settings.py as you suggested and it worked! Thank you for your support:)
@Hoshitter1 as you can read, there is not a perfect solution.
I will suggest in the README to use
django-ipware, I could do it by default but I prefere to keep this library dependency-free.Any suggestion is appreciated.