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

Accept connections with an without PROXY protocol on the same port #213

Open
thegcat opened this issue Jul 7, 2024 · 1 comment
Open

Comments

@thegcat
Copy link

thegcat commented Jul 7, 2024

We are migrating away from a HAProxy-based setup and had one incoming port we used to proxy connection with the PROXY protocol to a backend service (exim in this case, but this is not important). On this port we had incoming connections directly from clients, i.e. without incoming PROXY protocol lines, and incoming connections that went through an upstream proxy and would already have PROXY protocol lines. This was not an issue.

We have been unable to replicate this setup with Caddy and the l4 plugin. Either we add the proxy_protocol handler on the incoming port used for this and only connections with the PROXY protocol lines are accepted/handled, or we do not add the handler and only connections without the PROXY protocol lines go through correctly, the others also go through but exim chokes on them (maybe they have both PROXY protocol lines? We didn’t tcpdump and check.)

Is it possible to create a port agnostic to the presence or not of the PROXY protocol line?

@mholt
Copy link
Owner

mholt commented Jul 15, 2024

It sounds like you are looking for the PROXY protocol matcher? https://github.com/mholt/caddy-l4/blob/master/modules/l4proxyprotocol/matcher.go

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

No branches or pull requests

2 participants