Skip to main content

django-httpxforwardedfor

https://travis-ci.org/PaesslerAG/django-httpxforwardedfor.svg?branch=master

Quickstart

Install django-httpxforwardedfor:

pip install django-httpxforwardedfor

Configure it in the settings of your django project:

# Make sure it is at the beginning of the list of middle-ware classes.
# Only other middle-ware classes working on the remote address should
# precede it.
MIDDLEWARE = [
    'httpxforwardedfor.middleware.HttpXForwardedForMiddleware',
] + MIDDLEWARE

# Only allow HTTP_X_FORWARDED_FOR, if the request is marked as secure.
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')

# To only allow change of the REMOTE_ADDR for requests via HTTPS.
# The default is to allow all requests.
TRUST_ONLY_HTTPS_PROXY = True

Release Notes

  • 0.3.1 - dropping support for Python 3.4 as it ran into EOL in March19

  • 0.3.0 - update supported versions according to https://www.djangoproject.com/download/#supported-versions and https://devguide.python.org/#status-of-python-branches

    • dropping support for Django 1.10 and Python 3.2 and 3.3

    • adding support for Python 3.7

    • adding support for Django 2.0

    • adding support for Django 2.1

  • 0.2.0 - futureproof release

    • adapt to new middleware format of django 1.10+

    • drop support for python 3.3, django < 1.10

  • 0.1.2 - initial release

    • supports Django 1.8, 1.9, 1.10, 1.11 on python 2.7, 3.3, 3.4, 3.5, and 3.6 - as per the official django docs

    • configuration to activate forwarding of header only for safe requests and trusting only https requests in general.

Contributing

As an open source project, we welcome contributions.

The code lives on github.

Reporting issues/improvements

Please open an issue on github or provide a pull request whether for code or for the documentation.

For non-trivial changes, we kindly ask you to open an issue, as it might be rejected. However, if the diff of a pull request better illustrates the point, feel free to make it a pull request anyway.

Pull Requests

  • for code changes

    • it must have tests covering the change. You might be asked to cover missing scenarios

    • the latest flake8 will be run and shouldn’t produce any warning

    • if the change is significant enough, documentation has to be provided

Setting up all Python versions

sudo apt-get -y install software-properties-common
sudo add-apt-repository ppa:fkrull/deadsnakes
sudo apt-get update
for version in 3.5 3.6 3.7; do
  py=python$version
  sudo apt-get -y install ${py} ${py}-dev
done

Code of Conduct

As it is a Django extension, it follows Django’s own Code of Conduct. As there is no mailing list yet, please just email one of the main authors (see setup.py file or github contributors)

Metadata

Release files for django-httpxforwardedfor 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-httpxforwardedfor 0.3.1
File Size Uploaded Provenance Actions
django-httpxforwardedfor-0.3.1.tar.gz 6.3 kB Without provenance Details for django-httpxforwardedfor-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-httpxforwardedfor 0.3.1
File Interpreter ABI Platform Actions
django_httpxforwardedfor-0.3.1-py2.py3-none-any.whl Python 2, Python 3 none any Details for django_httpxforwardedfor-0.3.1-py2.py3-none-any.whl

Total release size: 12.9 kB

Release files / django-httpxforwardedfor-0.3.1.tar.gz

Download URL django-httpxforwardedfor-0.3.1.tar.gz
Size 6.3 kB
Tags Source
SHA-256 checksum
How to use checksums
029e33a129fa20c98eae40a7720697af2330316cf850c88c2691bde6b80aa93a
BLAKE2b-256 checksum
How to use checksums
651ce6ad03ef00a7f77f84a68b1716d5027d1de6b310184d35680f306bea7c15
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.9.1 pkginfo/1.4.1 requests/2.18.1 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.14.0 CPython/2.7.6

Release files / django_httpxforwardedfor-0.3.1-py2.py3-none-any.whl

Download URL django_httpxforwardedfor-0.3.1-py2.py3-none-any.whl
Size 6.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
526dcff7eaf13215e4a06a72e893850ba5fb3d7a91fdf3e33f2c80cf1bd53cb2
BLAKE2b-256 checksum
How to use checksums
ba5129e9c5ed55fc2ab0649b8258c0df24b1b98d5c651cac5857b5193758c317
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.9.1 pkginfo/1.4.1 requests/2.18.1 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.14.0 CPython/2.7.6

Security for django-httpxforwardedfor 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page