question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MAINTENANCE_MODE_IGNORE_IP_ADDRESSES does not work.

See original GitHub issue

How 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:closed
  • Created 5 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Hoshitter1commented, Mar 2, 2019

@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:)

0reactions
fabiocaccamocommented, Feb 28, 2019

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found