Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a proxy-count option to support multiple proxies #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

danielcompton
Copy link

@danielcompton danielcompton commented Jan 22, 2020

In some environments, a request may be forwarded through multiple trusted proxies before it reaches the ring server. This commit adds a proxy-count option to configure how far from the end the middleware should look for the 'real' :remote-address.

For a concrete example, take Google Cloud App Engine Flexible with Docker. A request comes into the load balancer. The request is proxied to a web server on the VM, where it is re-proxied a final time to the application. In this case, if a request starts with no X-Forwarded-For headers, it will end up looking something like

{:headers {"X-Forwarded-For" "122.54.196.223, 216.58.196.147"}
 :remote-addr "172.17.0.5"
 ;; ... 
 }

where 122.54.196.223 is my home IP address, 216.58.196.147 is the Google load balancer address, and 172.17.0.5 is the Docker container bridge IP address.

Also, what do you think should happen if proxy-count is set to 0? Is that an error condition, or should this middleware remove itself and just call (handler request)?

This is not ready for merging, I'm opening this up for discussion on naming, documentation, implementation details, etc. What are your thoughts?

In some environments, a request may be forwarded through multiple
trusted proxies before it reaches the ring server. This commit adds
a proxy-count option to configure how far from the end the middleware
should look for the 'real' :remote-address.
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.

1 participant