@marcel91200 / caddy Mirror · read-only / commits / c5b66cf8
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 11, 08:30 UTC

Set the QUIC InitialPacketSize to 1200 bytes (#7886)

quic-go defaults the `InitialPacketSize` to 1280 bytes. This is used for the size of the payload plus UDP header. When quic-go creates its initial handshake packet, it pads it to this size as an optimization for the anti-amplification limit (which does not really apply to Caddy's server connections). Tailscale uses an MTU of 1280 (the minimum IPv6 MTU) because it is a tunnel operating in unknown environments, possibly inside other tunnels. When wrapped in an IP header (either v4 or v6), the 1280 byte QUIC packet constructed by quic-go exceeds the Tailscale MTU and gets dropped. This makes it impossible to respond to an HTTP3 connection attempt over Tailscale when using the default `InitialPacketSize`. We explicitly set the `InitialPacketSize` to 1200 (its minimum) to support HTTP3 connections over Tailscale and other low MTU connections. Once the connection is established, quic-go can perform MTU discovery to increase the packet size to the maximum supported by the connection, so any throughput loss due to the lowered `InitialPacketSize` is short-lived.

Salynn committed Jul 25, 2026 at 17:48 UTC c5b66cf8eae1e7a0d6f1b412a26de3fc11d73fc9
2 files changed +6 -4
listeners.go
+3 -2
@@ -480,8 +480,9 @@ func (na NetworkAddress) ListenQUIC(ctx context.Context, portOffset uint, config
480 earlyLn, err := tr.ListenEarly(
481 http3.ConfigureTLSConfig(quicTlsConfig),
482 &quic.Config{
483 - Allow0RTT: allow0rtt,
484 - Tracer: h3qlog.DefaultConnectionTracer,
483 + InitialPacketSize: 1200,
484 + Allow0RTT: allow0rtt,
485 + Tracer: h3qlog.DefaultConnectionTracer,
486 },
487 )
488 if err != nil {
modules/caddyhttp/server.go
+3 -2
@@ -825,8 +825,9 @@ func (s *Server) serveHTTP3(addr caddy.NetworkAddress, tlsCfg *tls.Config) error
825 TLSConfig: tlsCfg,
826 MaxHeaderBytes: s.MaxHeaderBytes,
827 QUICConfig: &quic.Config{
828 - Versions: []quic.Version{quic.Version1, quic.Version2},
829 - Tracer: h3qlog.DefaultConnectionTracer,
828 + Versions: []quic.Version{quic.Version1, quic.Version2},
829 + InitialPacketSize: 1200,
830 + Tracer: h3qlog.DefaultConnectionTracer,
831 },
832 IdleTimeout: time.Duration(s.IdleTimeout),
833 }