{"id":30283211,"url":"https://github.com/tn3w/flask-realip","last_synced_at":"2025-08-16T17:33:51.862Z","repository":{"id":297270499,"uuid":"996293811","full_name":"tn3w/flask-realip","owner":"tn3w","description":"A Flask extension that obtains the real IP address of clients behind proxies.","archived":false,"fork":false,"pushed_at":"2025-06-11T19:30:14.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-14T19:34:55.140Z","etag":null,"topics":["flask","ip-address","python"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/flask-realip/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tn3w.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-04T18:33:03.000Z","updated_at":"2025-06-11T19:30:20.000Z","dependencies_parsed_at":"2025-06-04T22:50:18.818Z","dependency_job_id":"19713b75-eaaa-4ae4-9a1c-1f519d5aca61","html_url":"https://github.com/tn3w/flask-realip","commit_stats":null,"previous_names":["tn3w/flask-realip"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tn3w/flask-realip","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tn3w%2Fflask-realip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tn3w%2Fflask-realip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tn3w%2Fflask-realip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tn3w%2Fflask-realip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tn3w","download_url":"https://codeload.github.com/tn3w/flask-realip/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tn3w%2Fflask-realip/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270746897,"owners_count":24638445,"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-08-16T02:00:11.002Z","response_time":91,"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":["flask","ip-address","python"],"created_at":"2025-08-16T17:33:50.850Z","updated_at":"2025-08-16T17:33:51.850Z","avatar_url":"https://github.com/tn3w.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flask-RealIP\n\nA Flask extension that obtains the real IP address of clients behind proxies.\n\n## Description\n\nFlask-RealIP is a simple extension for Flask applications that automatically determines the real IP address of incoming requests, even when your application is behind one or more proxies. It properly handles:\n\n- X-Forwarded-For and other proxy headers\n- IPv4 and IPv6 addresses\n- IPv4-mapped IPv6 addresses\n- Address validation to prevent spoofing\n\n## Installation\n\nYou can install Flask-RealIP using pip:\n\n```bash\npip install flask-realip\n```\n\nOr from the source code:\n\n```bash\ngit clone https://github.com/tn3w/flask-realip.git\ncd flask-realip\npip install -e .\n```\n\n## Usage\n\n### Basic Usage\n\n```python\nfrom flask import Flask, request\nfrom flask_realip import RealIP\n\napp = Flask(__name__)\nreal_ip = RealIP(app)\n\n@app.route('/')\ndef index():\n    return f\"Your IP address is: {request.remote_addr}\"\n```\n\n### Configuration\n\nFlask-RealIP can be configured with the following options:\n\n```python\n# Initialize with custom options\nreal_ip = RealIP(\n    app=app,\n    trusted_proxies=['127.0.0.1', '10.0.0.0/8'],\n    forwarded_headers=['HTTP_X_REAL_IP', 'HTTP_X_FORWARDED_FOR'],\n    proxied_only=True\n)\n```\n\nOr using Flask's configuration system:\n\n```python\n# Configure in Flask app\napp = Flask(__name__)\napp.config['REAL_IP_TRUSTED_PROXIES'] = ['127.0.0.1', '10.0.0.0/8']\napp.config['REAL_IP_FORWARDED_HEADERS'] = ['HTTP_X_REAL_IP', 'HTTP_X_FORWARDED_FOR']\napp.config['REAL_IP_PROXIED_ONLY'] = True\n\nreal_ip = RealIP(app)\n```\n\n### With Application Factory Pattern\n\n```python\nfrom flask import Flask\nfrom flask_realip import RealIP\n\nreal_ip = RealIP()\n\ndef create_app():\n    app = Flask(__name__)\n    # Configure Flask app...\n    \n    real_ip.init_app(app)\n    return app\n```\n\n## Configuration Options\n\n- `trusted_proxies`: List of trusted proxy IP addresses that are allowed to set forwarding headers. Default: `['127.0.0.1', '::1']`\n- `forwarded_headers`: List of headers to check for forwarded IPs, in order of preference. Default: `['HTTP_X_FORWARDED_FOR', 'HTTP_X_REAL_IP', 'HTTP_X_FORWARDED', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED']`\n- `proxied_only`: If True, only apply the middleware for requests from trusted proxies. Default: `True`\n\n## How It Works\n\nWhen a request passes through proxies, the original client IP gets stored in headers like X-Forwarded-For. Flask-RealIP examines these headers from trusted proxies, validates the IP addresses, and makes them available through Flask's standard `request.remote_addr`.\n\n## License\n\nCopyright 2025 TN3W\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftn3w%2Fflask-realip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftn3w%2Fflask-realip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftn3w%2Fflask-realip/lists"}