Skip to content

Preserve forwarded IP address for trusted proxy chains#1224

Merged
tenderlove merged 1 commit intorack:masterfrom
SamSaffron:master
Apr 14, 2018
Merged

Preserve forwarded IP address for trusted proxy chains#1224
tenderlove merged 1 commit intorack:masterfrom
SamSaffron:master

Conversation

@SamSaffron
Copy link
Copy Markdown
Contributor

Sometimes proxies make requests to Rack applications, for example
HAProxy health checks and so on.

Previously the forwarded IP implementation ate up these IP addresses,
making it hard to tell in Rack applications who made the request.

@rafaelfranca @matthewd thoughts on this?

Rack is eating up my IP addresses so its totally mucking with my rate limiter.

My actual problem is that I have a "global" rate limiter in the app and for whatever crazy reason AWS ELB loves making enormous amounts of requests for its health checks, I noticed just for meta.discourse.org we had 5 different load balancers checking every cycle. They all have unique private IP addresses though, but the traffic goes ELB -> NGINX -> Unicorn. So it needs to get the ELB address out as remote IP which is a private IP.

Sometimes proxies make requests to Rack applications, for example
HAProxy health checks and so on.

Previously the forwarded IP implementation ate up these IP addresses,
making it hard to tell in Rack applications who made the request
@matthewd
Copy link
Copy Markdown
Contributor

matthewd commented Jan 5, 2018

Yeah, this sounds right to me (see also rails/rails#14600, which I've still never revisited 😔)

@SamSaffron
Copy link
Copy Markdown
Contributor Author

thanks @matthewd , better ping @indirect here since he was responsible for the first implementation here.

@SamSaffron
Copy link
Copy Markdown
Contributor Author

failures seem unrelated, travis config here is a bit ill

timeout in one case, broken on ruby head in another due to rack

@SamSaffron
Copy link
Copy Markdown
Contributor Author

anything? anyone?

@SamSaffron
Copy link
Copy Markdown
Contributor Author

Almost the same PR is here: #1160

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