logoalt Hacker News

alright256504/23/20251 replyview on HN

    x_forwarded_for = headers.get("X-Forwarded-For")
    if x_forwarded_for is None:
        x_forwarded_for = ipaddress.IPv4Address._string_from_ip_int(
            randint(0, MAX_IPV4)
        )
lol

Replies

marcusb04/23/2025

The original author claims this is to prevent API gateway from leaking the true client IP.

show 1 reply