Skip to content

Security: Ratelimit throttles no longer work after switch to k8s #2133

Closed
@mlissner

Description

@mlissner

Our architecture now uses CloudFront, which proxies to Elastic Load Balancer, which proxies to our application server. In the process, our x-forwarded-for headers, which we formerly relied on, are getting longer.

Assume a client IP address of 1.2.3.4. In the past, when it was just nginx forwarding to gunicorn, the header might look like:

x-forwarded-for: 1.2.3.4

We'd grab that and be all good. Now, with Cloudfront (IP: 2.3.4.5) and ELB (IP: 3.4.5.6), we get something closer to:

x-forwarded-for: 1.2.3.4, 2.3.4.5

Alas, Django Ratelimit has no ambition of doing good things with this, and since we have many Cloudfront termination points and many ELBs, we can't use the X-forward-for keys like we used to, and they fail open, meaning that they don't do anything anymore.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions