-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Closed
Labels
bug 🐞Something isn't workingSomething isn't workinggood first issue 🐤Good for newcomersGood for newcomers
Milestone
Description
Using this caddyfile fragment as an example,
:80 {
reverse_proxy {
to unix//data/socket
transport http {
proxy_protocol v2
}
}
}
the generated stream is prefixed with the proxy protocol sequence as defined by haproxy.
See this hex dump:
0d 0a 0d 0a 00 0d 0a 51 55 49 54 0a 20 11 00 0c c0 a8 58 5b 00 00 00 00 00 00 00 00
The 13th byte ("20") is the protocol version and command. The lowest four bits default to 0, meaning LOCAL, but should be initialized to 1, meaning PROXY. Only in this case the receiver uses the information provided in the protocol block to get the original address.
As it stands, the remote address encoded in the header is being ignored by the counterpart.
The related code section is in caddyhttp / reverseproxy / httptransport.go, in function NewTransport().
The section about ProxyProtocol could be simplified by using function HeaderProxyFromAddrs() from the go-proxyproto module.
Metadata
Metadata
Assignees
Labels
bug 🐞Something isn't workingSomething isn't workinggood first issue 🐤Good for newcomersGood for newcomers