Django package to restrict access just to cloudflare workers
Project description
Overview
The django-cloudflare-restrictor package provides a convient way to restrict access to your application server, such that it will only respond to requests that come via cloudflare's network.
Installation
Install the package from pypi
pip install django-cloudflare-restrictor
Add to INSTALLED APPS in your settings file
INSTALLED_APPS = [
'django_cloudflare_restrictor',
...
And add to MIDDLEWARE in your settings file
MIDDLEWARE = [
'django_cloudflare_restrictor.middleware.CloudflareRestrictorMiddleware',
...
]
Set the additional settings as desired
CLOUDFLARE_RESTRICTOR_ENABLED = True
CLOUDFLARE_RESTRICTOR_ADDITIONAL_NETWORKS = ["127.0.0.0/8"]
CLOUDFLARE_RESTRICTOR_EXCLUDE_PATHS = [
'^/cron/$',
]
If you want to confirm that the IP blocks stored in the django-cloudflare-restrictor package are up to date you can use the check_cloudflare_ips command. This will log a warning if the IP addresses are out of date.
python manage.py check_cloudflare_ips
Based on historical evidence, it appears that Cloudflare gives around 1 month's advance notice of IP address changes, by publishing the new addresses in advance on their site. Updates to these lists are very infrequent (approx once per every 2 years)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django-cloudflare-restrictor-1.0.2.tar.gz.
File metadata
- Download URL: django-cloudflare-restrictor-1.0.2.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
111b9dbb647eb44b7cb212eb326792545b3c4c7e1009fb624df5da7acd4b8100
|
|
| MD5 |
45a28ab155c332e692a996bd92f0465b
|
|
| BLAKE2b-256 |
161fe0d211b3a9ad7207aba14b09c98d71d5c7c2774dec4d7fca6527d435f18b
|
File details
Details for the file django_cloudflare_restrictor-1.0.2-py3-none-any.whl.
File metadata
- Download URL: django_cloudflare_restrictor-1.0.2-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
988103d32d18d3d97e50727d91edf302a9a4df99c135c588869d7d263cd0b0a8
|
|
| MD5 |
ac2defc0d50c4c7056c52f036ebe608d
|
|
| BLAKE2b-256 |
8397343b31a410b4f1d0446642b5226632d8d2b70db431664f99af406b51bd06
|