mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Fix: get the left-most ip when there is multiple (#673)
X-Forwarded-For: <client>, <proxy1>, <proxy2> get the <client> part when there is multiple proxies or load balancers
This commit is contained in:
parent
3aa40224a2
commit
c89bf6fbf8
1 changed files with 2 additions and 0 deletions
|
|
@ -241,6 +241,8 @@ class WebhookRequestHandler(web.View):
|
|||
# For reverse proxy (nginx)
|
||||
forwarded_for = self.request.headers.get('X-Forwarded-For', None)
|
||||
if forwarded_for:
|
||||
# get the left-most ip when there is multiple ips (request got through multiple proxy/load balancers)
|
||||
forwarded_for = forwarded_for.split(",")[0]
|
||||
return forwarded_for, _check_ip(forwarded_for)
|
||||
|
||||
# For default method
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue