fix(fallback): derive a linked fallback's PROXY protocol header from its child (#6880)

Turning on Proxy Protocol for a local fallback target behind a VLESS/Trojan TLS
master broke the fallback: the row was saved with xver 0, so the master sent no
PROXY header and the child, now expecting one, rejected every connection (#6835).

A fallback without an explicit dest already takes its address from the child at
build time; it now also sends header v1 when the child accepts PROXY protocol
(sockopt or the raw/ws/httpupgrade transport flag) and the row sets no xver of
its own, so either order of enabling it works, from the panel or the API. Editing
a child's listen, port or PROXY flag rebuilds the masters that derive from it,
since re-adding only the child left them stale. Fixes #6835.
This commit is contained in:
Matt Van Horn
2026-10-23 22:30:09 -07:00
committed by GitHub
parent 136c1c4d50
commit e0d2a0c58c
3 changed files with 140 additions and 2 deletions
+11
View File
@@ -2267,6 +2267,17 @@ func (s *InboundService) UpdateInbound(inbound *model.Inbound) (*model.Inbound,
if err := tx.Save(oldInbound).Error; err != nil {
return err
}
// A master's running fallback was built from this child's listen, port and PROXY flag;
// re-adding only the child would leave the master pointing at the old ones.
if fallbackTargetChanged(&running, oldInbound) {
linked, err := s.fallbackService.HasDerivedFallbackTo(tx, oldInbound.Id)
if err != nil {
return err
}
if linked {
needRestart = true
}
}
newClients, gcErr := s.GetClients(oldInbound)
if gcErr != nil {
return gcErr