prometheus: 200 MiB upload cap + Caddy block fix for the "<" error
Two bugs under one roof.
The visible one: a publisher uploading anything over 10 MB on the live
site got "Network error — Unexpected token '<'" in the browser console.
Cause: the Caddy block I wrote for prometheus.x had
`request_body { max_size 2GB }` nested inside the handle block, where it
is a syntax Caddy parses but does not apply, so Caddy's own 10 MB
default was still the gate. Any oversize POST got Caddy's HTML 413 page,
which the browser's JSON parser choked on at the leading `<`.
Fix: moved `request_body { max_size … }` to the top of the prometheus.x
site block (outside `handle`), where Caddy actually honours it. The live
Caddyfile on p2pexchange is already patched + reloaded; a 50 MB upload
verified through the end-to-end path (Caddy → service → clamd → signed
scan report).
The scope one: 2 GiB was more than Prometheus should offer to publishers
at launch. Mobile apps are usually ~100 MB and even most desktop
installers come in well under 200 MiB. Dropping to 200 MiB:
- Fits every Android APK and most desktop installers.
- Shrinks the operator's Sia storage bill (fewer accidental Steam-size
uploads).
- Keeps the "publishers of larger binaries self-host and submit a
manifest with the external URL + SHA" escape hatch — the scanner
still fetches the URL and checks the hash, so a 5 GB game isn't
locked out, Prometheus just doesn't eat its storage.
Changes:
service/uploads.js MAX_FILE_BYTES default: 2 GiB → 200 MiB
service/pages.js /submit step-1 subtitle: "any size up to
2 GiB" → "up to 200 MiB"
deploy/prometheus-x.conf (unused angie fallback) 2g → 200m
deploy/apps-silentmode-st.conf (unused angie fallback) 2g → 200m
PROMETHEUS_MAX_UPLOAD_BYTES env still overrides per-instance.
This commit is contained in:
parent
916440fb31
commit
bbef07c825
4 changed files with 15 additions and 10 deletions
|
|
@ -36,9 +36,9 @@ server {
|
|||
proxy_set_header X-Forwarded-Proto https;
|
||||
proxy_set_header X-Forwarded-Host apps.silentmode.st;
|
||||
|
||||
# Large publisher uploads need a generous ceiling — matches the service's
|
||||
# own 2 GiB cap. Reads are small; this governs POST /api/upload.
|
||||
client_max_body_size 2g;
|
||||
# Matches the service's 200 MiB upload cap. Reads are small; this
|
||||
# governs POST /api/upload.
|
||||
client_max_body_size 200m;
|
||||
proxy_request_buffering off;
|
||||
|
||||
# The service's own long-cache headers decide for static assets; this
|
||||
|
|
|
|||
|
|
@ -36,9 +36,10 @@ server {
|
|||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
|
||||
# Publishers upload binaries that can be hundreds of MB. 2 GiB
|
||||
# matches the service's own cap in uploads.js.
|
||||
client_max_body_size 2g;
|
||||
# 200 MiB fits Android APKs and most desktop installers; matches the
|
||||
# service's own cap in uploads.js. Publishers of larger binaries
|
||||
# self-host and submit a manifest with the external URL + SHA.
|
||||
client_max_body_size 200m;
|
||||
proxy_request_buffering off;
|
||||
|
||||
proxy_buffering off;
|
||||
|
|
|
|||
|
|
@ -321,7 +321,7 @@ export function submit() {
|
|||
<!-- Progress indicator -->
|
||||
<section class="plain">
|
||||
<ol class="steps" id="step-indicator" style="margin:0 0 2rem">
|
||||
<li data-step="1"><b>Upload</b> <span id="s1-sub">the binary (any size up to 2 GiB)</span></li>
|
||||
<li data-step="1"><b>Upload</b> <span id="s1-sub">the binary (up to 200 MiB)</span></li>
|
||||
<li data-step="2"><b>Describe</b> <span id="s2-sub">name, publisher name, category, description</span></li>
|
||||
<li data-step="3"><b>Sign</b> <span id="s3-sub">with the BCH key for your publisher BNS name</span></li>
|
||||
<li data-step="4"><b>Publish</b> <span id="s4-sub">POST to the directory</span></li>
|
||||
|
|
|
|||
|
|
@ -36,10 +36,14 @@ import { signReport } from './signing.js';
|
|||
const UPLOAD_DIR = process.env.PROMETHEUS_UPLOAD_DIR
|
||||
|| resolve(dirname(fileURLToPath(import.meta.url)), '..', 'uploads');
|
||||
|
||||
// 2 GiB — the ceiling, not the typical size. Change via env rather than code
|
||||
// so an operator can tighten it without a redeploy.
|
||||
// 200 MiB — fits every Android APK and most desktop installers; publishers
|
||||
// of larger binaries self-host and submit a manifest with the external URL +
|
||||
// SHA. The service's cap and Caddy's `request_body { max_size 200MB }` on
|
||||
// the prometheus.x vhost must stay in sync — if Caddy rejects first, the
|
||||
// browser gets an HTML 413 page that the JSON parser cannot read.
|
||||
// Change via env rather than code so an operator can tighten per-instance.
|
||||
const MAX_FILE_BYTES = Number(process.env.PROMETHEUS_MAX_UPLOAD_BYTES)
|
||||
|| 2 * 1024 * 1024 * 1024;
|
||||
|| 200 * 1024 * 1024;
|
||||
|
||||
/**
|
||||
* Express-style handler attached to `/api/upload`.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue