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

Hope that proxy_protocol can be enabled to receive (PROXY protocol v2) when the HTTP/3 server is running. #6827

Open
lxhao61 opened this issue Feb 5, 2025 · 2 comments
Labels
feature ⚙️ New feature or request

Comments

@lxhao61
Copy link

lxhao61 commented Feb 5, 2025

The caddy-l4 plugin is testing the support for sending proxy_protocol (PROXY protocol v2) over UDP.
Hope that proxy_protocol can be enabled to receive (PROXY protocol v2) when the HTTP/3 server is running.
Implementation example:

{
	log {
		level DEBUG
	}
	layer4 {
		tcp/:443 {
			@tsni tls sni zz.yy
			route @tsni {
				proxy {
					proxy_protocol v2
					upstream unix/@uds7443.sock
				}
			}
			route {
				proxy {
					proxy_protocol v2
					upstream tcp/127.0.0.1:8443
				}
			}
		}
		udp/:443 {
			@qsni quic sni xx.yy
			route @qsni {
				proxy {
					upstream udp/127.0.0.1:2443
				}
			}
			route {
				proxy {
					proxy_protocol v2
					upstream udp/127.0.0.1:8443
				}
			}
		}
	}
	servers 127.0.0.1:8443 {
		listener_wrappers {
			proxy_protocol {
				allow 127.0.0.1/32
			}
			tls
		}
	}
}

:8443, xx.zz:8443 {
	bind 127.0.0.1

	header {
		Alt-Svc "h3=\":443\"; ma=2592000"
		Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
	}
	file_server {
		root /var/www/html
	}
}

Related links:
1.mholt/caddy-l4#269
2.mholt/caddy-l4#283

@mholt mholt added the feature ⚙️ New feature or request label Feb 5, 2025
@vnxme
Copy link
Contributor

vnxme commented Feb 5, 2025

Good idea! Technically speaking, listener_wrappers do only exist for TCP connections, as they are implemented as net.Conn and net.Listener. UDP is connectionless, so it's implemented as net.PacketConn. Thus we have to develop a kind of packet_conn_wrappers mechanism to provide for processing anything (e.g. proxy protocol, layer4, etc.) before HTTP3 gets the incoming datagram.

By the way, if we do the above, I'd rather call them tcp_wrappers and udp_wrappers instead to account for those who don't speak golang.

@mholt
Copy link
Member

mholt commented Feb 5, 2025

tcp_wrappers is probably a better name for it, yeah. Might be too late to change it (easily) but we can look into it. If anyone wants to tinker with an implementation for this issue (if it's not too complicated), we can review it when we have a chance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature ⚙️ New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants