Skip to content

Conversation

@willbryant
Copy link
Contributor

Previously this was typically invoked for every address found in REMOTE_ADDR/HTTP_FORWARDED/HTTP_X_FORWARDED_FOR. When ip_filter matches against several hundred IP ranges (eg. Cloudfront IP ranges), whole ms could be wasted.

Now it'll only be invoked until one acceptable address is found.

Previously this was typically invoked for every address found in REMOTE_ADDR/HTTP_FORWARDED/HTTP_X_FORWARDED_FOR. When ip_filter matches against several hundred IP ranges (eg. Cloudfront IP ranges), whole ms could be wasted.

Now it'll only be invoked until one acceptable address is found.
Copy link
Contributor

@jeremyevans jeremyevans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this!

@ioquatix
Copy link
Member

@willbryant do you mind adding an entry to the changelog?

Copy link
Member

@ioquatix ioquatix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm okay with this. Of note, is that rejected_trusted_ip_addresses was removed, a public interface. Of course, it's no longer useful and was probably an implementation detail, and I checked GitHub code search and could not see any usage in the wild.

@willbryant
Copy link
Contributor Author

Yeah, I did wonder about that - and came to the same conclusion, but do you think I should restore it until a future major release to be on the safe side?

@ioquatix
Copy link
Member

One option is to restore it and add a deprecation note to it. It is the safest approach. However, it also makes more work for maintainers. So, I'm okay with either option. Let's see what @jeremyevans thinks.

@jeremyevans
Copy link
Contributor

I'm okay with this. Of note, is that rejected_trusted_ip_addresses was removed, a public interface. Of course, it's no longer useful and was probably an implementation detail, and I checked GitHub code search and could not see any usage in the wild.

Are you sure it was public? It comes after the private keyword.

@ioquatix
Copy link
Member

Ah yeah you are right, it's way up there haha.

@ioquatix ioquatix merged commit cf24be2 into rack:main Feb 21, 2025
16 checks passed
@willbryant willbryant deleted the optimize_request_ip branch February 21, 2025 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants