···193193194194Set `xrpc.trusted_proxy_header = "x-forwarded-for"` when doing this, otherwise every client looks like it comes from the proxy and the ratelimiter wil treat them as one very busy mister. Only set it behind a proxy the operator controls, since a direct client can like, invent that header.
195195196196+Add `xrpc.trusted_proxies = ["fd00:1::4", "10.89.0.4"]` for example, one entry per address that the proxy connects from, so the knot honors that header from the proxy alone & ratelimits anyone else by the address they connected from.
197197+196198The knot can also terminate TLS itself (and that's the only way to get its HTTP3 support) because a plain TCP frontend can't proxy QUIC. Using a certificate the operator already manages:
197199198200```toml
···2020pub use hex::{decode_hex, lowercase_hex};
21212222mod net;
2323-pub use net::forwarded_peer;
2323+pub use net::{PeerKey, ProxyTrust, TrustedProxies};
24242525pub use jacquard_common::CowStr;
2626pub use jacquard_common::DefaultStr;
···120120 GitError::AtomicRefs(_) => Self::conflict(message),
121121 GitError::UnsafeRepoDid(_) | GitError::ReservedDid(_) => Self::invalid_request(message),
122122 GitError::DepthExceeded(_) => Self::invalid_request(message),
123123+ GitError::ArchiveTooLarge { .. } => Self::request_too_large(message),
123124 GitError::Selection(_) => Self::overloaded(message),
124125 // Every oid passed to the object database here came from a ref this
125126 // knot already resolved or a tree it already read, so a miss means
···175175# Default value: 5242880
176176#max_response_bytes = 5242880
177177178178+# Upper bound on bytes that a single archive spools,
179179+# across all our surfaces: the sh.tangled.repo.archive query,
180180+# `git archive --remote` over SSH,
181181+# and the smart HTTP archive route.
182182+# The knot will refuse writing smth that would blast an archive past this bound.
183183+#
178184# Can also be specified via environment variable `KNOT_XRPC_MAX_ARCHIVE_BYTES`.
185185+#
179186# Default value: 1073741824
180187#max_archive_bytes = 1073741824
181188···265272#
266273# Can also be specified via environment variable `KNOT_XRPC_TRUSTED_PROXY_HEADER`.
267274#trusted_proxy_header =
275275+276276+# IP addresses whose `trusted_proxy_header` the knot honors,
277277+# without a port,
278278+# for ex the loopback address of a reverse proxy on the same host.
279279+# The knot rate-limits a request from any other address
280280+# by its own socket address and ignores the header.
281281+# Leave empty to honor the header from every peer,
282282+# which is safe *only* if nothing but the proxy can reach this knot.
283283+#
284284+# Can also be specified via environment variable `KNOT_XRPC_TRUSTED_PROXIES`.
285285+#
286286+# Default value: []
287287+#trusted_proxies = []
268288269289# Can also be specified via environment variable `KNOT_XRPC_EVENTS_REPLAY_BUFFER`.
270290# Default value: 4096