{"id":19499700,"url":"https://github.com/apsl/django-behind-lb","last_synced_at":"2025-09-16T16:44:24.553Z","repository":{"id":66126943,"uuid":"43603949","full_name":"APSL/django-behind-lb","owner":"APSL","description":"Behind-LB is a very simple and efficient Django middleware to obtain the client IP address when the project runs behind a trusted load balancer.","archived":false,"fork":false,"pushed_at":"2015-10-03T17:30:30.000Z","size":139,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-09-09T04:43:04.217Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/APSL.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-03T15:39:40.000Z","updated_at":"2015-11-15T14:16:02.000Z","dependencies_parsed_at":"2023-02-19T23:01:05.000Z","dependency_job_id":null,"html_url":"https://github.com/APSL/django-behind-lb","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/APSL/django-behind-lb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/APSL%2Fdjango-behind-lb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/APSL%2Fdjango-behind-lb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/APSL%2Fdjango-behind-lb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/APSL%2Fdjango-behind-lb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/APSL","download_url":"https://codeload.github.com/APSL/django-behind-lb/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/APSL%2Fdjango-behind-lb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275452729,"owners_count":25467565,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-16T02:00:10.229Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T22:05:52.388Z","updated_at":"2025-09-16T16:44:24.098Z","avatar_url":"https://github.com/APSL.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"=========\nBehind_LB\n=========\n\nBehind-LB is a very simple and efficient Django middleware to obtain\nthe client IP address when the project runs behind a trusted load\nbalancer.\n\nIt allows to specify the path that activate the middleware, for example\n``/`` or ``/a/specific/path``. The path *must* be specified in the variable\n``BEHIND_LB_PATH`` in your settings.py.\n\nIt works with any load balancer that sends the public remote address in\na fixed relative position in the header (first, second,... , last).\nFor example, Amazon ELB puts it in the last position, Google Compute\nLoad Balancer in the penultimate one. The position *must*\nbe specified in ``settings.BEHIND_LB_POSITION``.\n\nQuick start\n-----------\n\n1. Install the package:\n\n   ``pip install django-behind-lb``\n\n2. Just add ``django-behind-lb`` to your ``INSTALLED_APPS`` setting like this::\n\n    MIDDLEWARE_CLASSES = (\n        'behind_lb.middleware.BehindLB',\n        ...\n\n3. Configure the path and position in settings.py::\n\n    BEHIND_LB_PATH = \"/\"\n    BEHIND_LB_POSITION = -2 # For Google Compute Engine\n\n\n4. Try it reading the default ``request.META['REMOTE_ADDR']`` in a View class. It\n   should read the real client IP.\n\nPosition options\n----------------\n\nThe ``BEHIND_LB_PATH`` value specifies the position of the real IP address in the\n``X-Forwarded-For header``, where 0 is the first (or \"left\"), 1 the second, -2 the\npenultimate position and -1 the last one. Examples::\n\n    BEHIND_LB_POSITION =  0 # First\n\n    BEHIND_LB_POSITION = -2 # Next to last, for Google Compute Engine LB\n\n    BEHIND_LB_POSITION = -1 # Last, for Amazon EC2 LB\n\nIn Github\n---------\n\nThe code is available at https://github.com/APSL/django-behind-lb\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapsl%2Fdjango-behind-lb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapsl%2Fdjango-behind-lb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapsl%2Fdjango-behind-lb/lists"}