fix: raise body size limits for putObject (256 MiB) Project schemas for repos with many files can exceed Axum's default 2 MiB body limit and Caddy's default 10 MiB. Push to cospan.dev was hitting 413 on the schema upload (one big object per commit). Set both layers to 256 MiB, comfortably under the node's 1 GiB cap.

Author: Aaron Steven White
Commit aedf5c8b488885bf839e1b7fbcb089c0295b5727
Parent: 04062cbb68
Structural diff unavailable

These commits were pushed via plain git push, so no pre-parsed schemas are available. Install git-remote-cospan and re-push via panproto:// to see scope-level changes, breaking change detection, and semantic diffs.

brew install panproto/tap/git-remote-cospan
2 files changed +12 -0
@@ -17,5 +17,9 @@
1717 }
1818 
1919 node.{$DOMAIN:cospan.dev} {
20+	# Project schemas can be tens of MB; default 10 MiB rejects pushes.
21+	request_body {
22+		max_size 256MB
23+	}
2024 	reverse_proxy node:3001
2125 }
@@ -1,9 +1,16 @@
11 use axum::Router;
2+use axum::extract::DefaultBodyLimit;
23 use axum::routing::{get, post};
34 use std::sync::Arc;
45 use tower_http::cors::CorsLayer;
56 use tower_http::trace::TraceLayer;
67 
8+/// Maximum body size for putObject. Project schemas can be tens of MB
9+/// for repos with many files (one schema vertex per AST node), and the
10+/// default 2 MiB axum limit caused 413s on first push. 256 MiB matches
11+/// what the node can comfortably hold under its 1 GiB memory cap.
12+const PUT_OBJECT_BODY_LIMIT: usize = 256 * 1024 * 1024;
13+
714 use crate::git_compat;
815 use crate::handlers;
916 use crate::state::NodeState;
@@ -71,6 +78,7 @@ pub fn build(state: Arc<NodeState>) -> Router {
7178         .merge(xrpc)
7279         .merge(git)
7380         .merge(health)
81+        .layer(DefaultBodyLimit::max(PUT_OBJECT_BODY_LIMIT))
7482         .layer(TraceLayer::new_for_http())
7583         .layer(CorsLayer::permissive())
7684         .with_state(state)
cospan · schematic version control on atproto built on AT Protocol