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

Support HAPROXY proxy protocol on the server side #89

Open
akka-ci opened this issue Sep 8, 2016 · 14 comments
Open

Support HAPROXY proxy protocol on the server side #89

akka-ci opened this issue Sep 8, 2016 · 14 comments
Labels
1 - triaged Tickets that are safe to pick up for contributing in terms of likeliness of being accepted help wanted Identifies issues that the core team will likely not have time to work on nice-to-have (low-prio) Tasks which make sense, however are not very high priority, feel free to help out! t:server Issues related to the HTTP server
Milestone

Comments

@akka-ci
Copy link

akka-ci commented Sep 8, 2016

HAProxy defines a TCP-based "proxy protocol" that wraps / prefixes reverse-proxy traffic with metadata from the original client.

See http://www.haproxy.org/download/1.8/doc/proxy-protocol.txt.

Issue by prettynatty
Wednesday Jan 20, 2016 at 14:15 GMT
Originally opened as akka/akka#19541


Akka HTTP lacks proxy protocol support.
There already was a demand in spray/spray#846. It's impossible to implement anti-flood scenarios in case of plain tcp connections when there is no way to determine real client ip via HTTP headers passed from reverse proxy.

@akka-ci akka-ci added this to the http-backlog milestone Sep 8, 2016
@akka-ci akka-ci added nice-to-have (low-prio) Tasks which make sense, however are not very high priority, feel free to help out! t:http labels Sep 8, 2016
@akka-ci
Copy link
Author

akka-ci commented Sep 8, 2016

Comment by jrudolph
Thursday Jan 21, 2016 at 08:28 GMT


Here's a previous discussion on the mailing list: https://groups.google.com/d/msg/akka-user/TdrTq_3ebK8/31vj4MzPCAAJ

@akka-ci
Copy link
Author

akka-ci commented Sep 8, 2016

Comment by sclasen
Wednesday Feb 24, 2016 at 18:49 GMT


👍 please add.

@akka-ci
Copy link
Author

akka-ci commented Sep 8, 2016

Comment by sclasen
Wednesday Feb 24, 2016 at 18:51 GMT


prior netty art http://netty.io/4.1/api/io/netty/handler/codec/haproxy/HAProxyMessage.html

@jrudolph jrudolph added the 1 - triaged Tickets that are safe to pick up for contributing in terms of likeliness of being accepted label Sep 8, 2016
@ktoso ktoso removed the t:http label Sep 12, 2016
@jrudolph jrudolph added t:server Issues related to the HTTP server and removed t:http:server labels Nov 2, 2016
@sihil
Copy link

sihil commented Mar 8, 2017

👍 this would be really helpful so we don't have to unreliably guess the IP from the XFF header.

@jrudolph
Copy link
Contributor

jrudolph commented Mar 8, 2017

@sihil how is that related to XFF?

@sihil
Copy link

sihil commented Mar 8, 2017

We principally use AWS ELBs for routing traffic. They support the proxy protocol for passing on the user's IP address to applications behind the ELB. As an alternative they also add an X-Forwarded-For header - but it is hard to correctly identify the user IP correctly without knowing all possible addresses of ELB hosts that it can pass through.

@jrudolph
Copy link
Contributor

jrudolph commented Mar 8, 2017

Ah, sorry, I just didn't understand what this ticket was about. Thanks for the clarification.

@jrudolph jrudolph changed the title Support proxy protocol Support HAPROXY proxy protocol on the server side Mar 8, 2017
@jrudolph
Copy link
Contributor

jrudolph commented Mar 8, 2017

Updated the original ticket with more information.

@jrudolph jrudolph added the help wanted Identifies issues that the core team will likely not have time to work on label Mar 8, 2017
@ktoso
Copy link
Contributor

ktoso commented Mar 8, 2017

Ah HA Proxy protocol, that makes sense now. Thanks for explaining, I also was wondering what was meant in the ticket title :)

@sihil
Copy link

sihil commented Mar 14, 2017

Thanks @jrudolph.

If you have some pointers as to how to approach this or anything in akka-http that is a similar pattern then I'm open to having a bash at putting together a PR to address this. Unlikely to happen immediately due to other commitments though.

@kchaitanya1195
Copy link

kchaitanya1195 commented May 4, 2019

Can we simply parse the haproxy line and add it to the request as a header?
Something like this?

cc: @jrudolph @sihil

@nrktkt
Copy link
Contributor

nrktkt commented Apr 9, 2020

Support for this would be great. Right now our logs are littered with

Illegal request, responding with status '501 Not Implemented': Unsupported HTTP method: PROXY

entries, I'm not aware of a way to tell ELBs to only use XFF and not PROXY protocol (via kube at least).

@jrudolph
Copy link
Contributor

I'm not aware of a way to tell ELBs to only use XFF and not PROXY protocol (via kube at least).

I've got no recent experience but it sounds unlikely that there's no way to turn it off. There are so many different HTTP backend implementations and by far not all of them support the proxy protocol.

That said, we would welcome a PR that adds the capability. @kchaitanya1195's work looks promising but I'd prefer to keep it out of the HTTP parser (because it's not related to HTTP). If it would be something more general it would also work with HTTP2 etc.

@oker1
Copy link

oker1 commented Oct 26, 2021

I'm not aware of a way to tell ELBs to only use XFF and not PROXY protocol (via kube at least).

I've got no recent experience but it sounds unlikely that there's no way to turn it off. There are so many different HTTP backend implementations and by far not all of them support the proxy protocol.

That said, we would welcome a PR that adds the capability. @kchaitanya1195's work looks promising but I'd prefer to keep it out of the HTTP parser (because it's not related to HTTP). If it would be something more general it would also work with HTTP2 etc.

@jrudolph can you provide some pointers where would you start with an implementation? I'd like to give it a try but don't want to explore the whole codebase upfront.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 - triaged Tickets that are safe to pick up for contributing in terms of likeliness of being accepted help wanted Identifies issues that the core team will likely not have time to work on nice-to-have (low-prio) Tasks which make sense, however are not very high priority, feel free to help out! t:server Issues related to the HTTP server
Projects
None yet
Development

No branches or pull requests

7 participants