{"id":16132922,"url":"https://github.com/vvbbnn00/python_proxy_protocol","last_synced_at":"2025-10-23T19:30:58.159Z","repository":{"id":183802891,"uuid":"437328486","full_name":"vvbbnn00/python_proxy_protocol","owner":"vvbbnn00","description":"一种通过魔改代码实现让Python Web服务器支持Proxy Protocol的方法，支持flask","archived":false,"fork":false,"pushed_at":"2022-03-18T19:30:19.000Z","size":57,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2023-07-25T22:12:26.534Z","etag":null,"topics":["flask","haproxy","proxy","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vvbbnn00.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}},"created_at":"2021-12-11T16:11:02.000Z","updated_at":"2023-07-25T22:12:33.429Z","dependencies_parsed_at":null,"dependency_job_id":"d60c488b-e845-4600-b7a1-099ea18e0d55","html_url":"https://github.com/vvbbnn00/python_proxy_protocol","commit_stats":null,"previous_names":["vvbbnn00/python_proxy_protocol"],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vvbbnn00%2Fpython_proxy_protocol","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vvbbnn00%2Fpython_proxy_protocol/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vvbbnn00%2Fpython_proxy_protocol/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vvbbnn00%2Fpython_proxy_protocol/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vvbbnn00","download_url":"https://codeload.github.com/vvbbnn00/python_proxy_protocol/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219868015,"owners_count":16555810,"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","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","haproxy","proxy","python"],"created_at":"2024-10-09T22:35:15.323Z","updated_at":"2025-10-23T19:30:52.854Z","avatar_url":"https://github.com/vvbbnn00.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 简介\n此处介绍一种通过魔改代码实现让Python Web服务器支持Proxy Protocol的方法。本代码修改了http模块中BaseHTTPRequestHandler对象，因此，使用该模块作为Web服务器的所有应用，都支持Proxy Protocol，也就是说，在使用frp等软件进行端口穿透时，HTTP请求会被自动添加X-Forwarded-For和X-Real-IP标头，这会让获取真实IP更加简单。\n\n# 实现方法\n找到http/server.py中BaseHTTPRequestHandler对象，将本项目中的Python代码替换即可。\n\n# 协议标准\n参考：https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt\n\n# 测试\n经过测试，IPv4协议无异常，IPv6因条件限制无法测试，如有问题，欢迎发Issue或联系我！\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvvbbnn00%2Fpython_proxy_protocol","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvvbbnn00%2Fpython_proxy_protocol","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvvbbnn00%2Fpython_proxy_protocol/lists"}