Guide
Premium
Intermediate
Real Projects

File Uploads at Scale: Presigned URLs, Multipart, Real Type Validation and Safe Serving

A practical guide to getting file uploads out of your backend without opening holes along the way: what a presigned URL actually signs and what it leaves to the client, why a presigned PUT cannot enforce a maximum size while a presigned POST can with content-length-range, multipart uploads with presigned parts, a bounded concurrency pool and per-part retries with exponential backoff and jitter, the CORS configuration with ExposeHeaders ETag without which multipart fails even though every part returns 200, the AbortIncompleteMultipartUpload lifecycle rule that stops orphaned parts from billing for years without ever showing up in a ListObjects, why the ETag is not the MD5 for multipart objects and how to verify integrity properly with additional checksums (CRC64NVME by default since 2025), the pending → uploaded → ready state machine confirmed by s3:ObjectCreated notifications with an idempotent handler rather than by a client call that may never arrive, real type validation from magic bytes reading only the first 8 KB, image rewriting against EXIF metadata and decompression bombs, and serving user content safely (SVG and stored XSS, a separate cookie-less domain, nosniff, Content-Disposition and CSP). With production-ready code in Python, TypeScript, JSON and Bash, eight recurring mistakes, a production checklist and an FAQ.

32 minutes read
Josué Puig
1 views

Verificando acceso...

Loading comments...

Related Resources

Guía
PREMIUM

asyncio in Production: Never Block the Event Loop — TaskGroups, Cancellation and Bounded Concurrency

A practical asyncio guide for Python services in production: why blocking the event loop degrades the whole process without raising a single exception, how to catch it by measuring loop lag and with Python 3.14 introspection, structured concurrency with TaskGroup and handling ExceptionGroup via except*, the task the garbage collector makes vanish, timeouts with a deadline budget propagated across services, correct cancellation with cleanup and shield, bounded concurrency with semaphores and backpressured queues, synchronization primitives, and what changes with eager tasks, python -m asyncio pstree and free-threading. With production-ready code and a deployment checklist.

Guía
PREMIUM

Cache-Aside in Production: TTLs, Invalidation, and How to Prevent Cache Stampedes

The complete guide to the cache-aside pattern with Redis: jittered TTLs, correct invalidation, and the three defenses against cache stampedes (distributed lock, single-flight, and XFetch). Expanded with stale-while-revalidate, fail-open and circuit breakers, two-tier caching with RESP3 invalidation, delayed double delete and CDC, hot keys, eviction and memory management, observability with Prometheus, testing, choosing an engine (Redis, Valkey, Memcached), and a complete TypeScript implementation. With production-ready code in Python and TypeScript.

Guía
PREMIUM

Circuit Breakers: How to Prevent Cascading Failures in Distributed Systems

Learn to implement the circuit breaker pattern so a failing dependency never drags down your whole system: the three states (closed, open, half-open), sliding failure windows, limited probes to avoid thundering herds, robust fallbacks, and how to combine it with timeouts, retries, and bulkheads. Includes distributed state in Redis, observability with Prometheus, pytest testing, circuit breaking in Envoy/Istio, a full case study, and production-ready code in Python and TypeScript.