Skip to content

fix: name who answered an HTTP 413 in the upload limit message - #199

Merged
taleodor merged 3 commits into
mainfrom
2026-11-18-413-answered-by
Nov 18, 2026
Merged

taleodor merged 3 commits into
mainfrom
2026-11-18-413-answered-by

Conversation

@taleodor-claude

@taleodor-claude taleodor-claude commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Why

The PFA-10 upload-limit message replaces the raw 413 error and drops the page that came with it. That page is the only sign of which layer refused the request. ReARM's own nginx, the ReARM backend, and a proxy in front of ReARM (for example a Traefik buffering middleware with maxRequestBodyBytes, or a cloud gateway) all answer 413. Without it, an administrator can't tell which limit to raise.

What

uploadLimitMessage adds one sentence, before the batch hint, built from the start of the 413 page. rearm-client-go keeps it in StatusError.Body: the first 200 bytes of an answer that wasn't JSON.

  • ReARM's own error page: recognised by its contact address once its HTML entities are decoded. The sentence reads: "It was answered by the ReARM web server (nginx), whose limit is that Helm value."
  • Any other page: its text is quoted with tags removed and cut to 120 characters. The sentence reads: "It was answered by something in front of ReARM, which has a limit of its own; its answer begins: "…"". Traefik's buffering middleware answers Request Entity Too Large; a cloud gateway usually names itself, for example Microsoft-Azure-Application-Gateway/v2.
  • The servlet container's page (HTTP Status 413, Apache Tomcat): the backend sends this instead of JSON when a filter reads the parts before the upload handler, and ReARM's nginx passes it through. The sentence reads: "It was answered by the ReARM backend, whose limit is that Helm value."
  • No page: a JSON answer (the ReARM backend's own limit) or an empty body adds nothing.

The quote never prints markup. Style and script blocks are removed with their content; a tag the 200-byte cut left unclosed is removed; a character the cut split is dropped. The 120-character cut falls on a character boundary.

The helper is limitAnsweredBy, because answeredBy already exists in the board wait code. No client-go change is needed.

Tests

  • New TestUploadLimitMessageNamesWhoAnsweredFromCutPages cuts realistic pages at 200 bytes, as rearm-client-go does. It covers the Tomcat page cut inside its style block, a gateway page cut mid-tag, style and script blocks, and a split last character, plus a rune-boundary check on a long accented answer. Each case asserts its fixture has the property under test, and every case fails against the earlier code.
  • New TestUploadLimitMessageNamesWhoAnswered covers ReARM's page (entities decoded), Traefik plain text, another nginx, a cloud gateway, truncation, no page and markup only. It also checks that no markup is printed and the batch hint stays last.
  • The existing PFA-10 tests are unchanged and pass. go vet ./cmd/ and go test ./... pass.
  • Live check against a ReARM 26.11.36 instance with a batch over the 50 MB default limit:
    • through the public URL, the message names the ReARM web server (nginx);
    • straight to the backend (JSON 413), the message has no extra sentence.

🤖 Generated with Claude Code

taleodor-claude and others added 3 commits November 18, 2026 18:28
The PFA-10 message dropped the 413 page, so a client could not tell which layer refused the request. It now adds one sentence from the start of that page (StatusError.Body): ReARM own error page, recognised by its decoded contact address, is named as the ReARM web server (nginx) whose limit is the Helm value; any other page is quoted with its tags removed and named as something in front of ReARM with a limit of its own, for example a Traefik buffering middleware or a cloud gateway. A JSON answer (the ReARM backend) or an empty page adds nothing.

ReARM-Agentic-Session: cli-413-answered-by-1795026403
ReARM-Agent: 62df357e-a3a4-4df5-82d4-049e629d1c6b
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…er upload limit tests

ReARM-Agentic-Session: cli-413-r2-1795026644
ReARM-Agent: 62df357e-a3a4-4df5-82d4-049e629d1c6b
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ge and quotes no markup

Review of the who-answered sentence. The servlet container page (HTTP Status 413, Apache Tomcat), which the backend sends when a filter reads the parts before the upload handler, is now named as the ReARM backend with the same Helm value instead of a proxy in front of ReARM. Style and script blocks are removed with their content, a tag the 200-byte cut left unclosed is removed, a character the cut split is dropped, and the quote is cut on a character boundary. New tests cut realistic pages at 200 bytes and assert each fixture has the property its case is about; they fail against the previous code.

ReARM-Agentic-Session: cli-413-r3-1795028364
ReARM-Agent: 62df357e-a3a4-4df5-82d4-049e629d1c6b
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@taleodor
taleodor merged commit 05115a7 into main Nov 18, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants