惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Visual Studio Blog
Recent Announcements
Recent Announcements
雷峰网
雷峰网
The GitHub Blog
The GitHub Blog
罗磊的独立博客
月光博客
月光博客
J
Java Code Geeks
A
About on SuperTechFans
Microsoft Security Blog
Microsoft Security Blog
D
Docker
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
F
Fortinet All Blogs
U
Unit 42
C
Check Point Blog
Martin Fowler
Martin Fowler
有赞技术团队
有赞技术团队
博客园 - 叶小钗
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
酷 壳 – CoolShell
酷 壳 – CoolShell
Blog — PlanetScale
Blog — PlanetScale
大猫的无限游戏
大猫的无限游戏
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
阮一峰的网络日志
阮一峰的网络日志
MyScale Blog
MyScale Blog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Your R2 presigned URL has a shorter TTL than you think — ...
강해수 · 2026-06-17 · via DEV Community

강해수

A 3600-second presigned URL expiring after 38 minutes isn't a permissions bug. It's a clock skew bug — and it took me an NTP issue on my dev laptop to finally see it clearly.

R2's presigned URL validation is S3-compatible, which means expiry is calculated from the X-Amz-Date value baked into the URL at signing time — not from wall-clock time at first use. If the Worker PoP that signs the URL has a clock 30 seconds ahead of the PoP that validates the request, you silently lose 30 seconds off the back end. That's survivable. The nastier version is a drifting client clock: I had a mobile client running 4 minutes fast, and a URL signed with a nominal 1-hour TTL was throwing SignatureDoesNotMatch errors with 5 minutes left on the clock. From the user's side it just looked like a 403 permissions failure — no indication it was a timing problem at all.

The fix I landed on is a signing buffer: tell the client the URL expires in nominalTtl, but actually sign it for nominalTtl + 300s. Five extra minutes absorbed every real-world drift case I've seen in production traffic:

const CLOCK_SKEW_BUFFER_SECONDS = 300;

export async function signGetUrlWithBuffer(
  env: Env,
  key: string,
  nominalTtlSeconds: number
): Promise<{ url: string; expiresAt: number }> {
  const signingTtl = nominalTtlSeconds + CLOCK_SKEW_BUFFER_SECONDS;
  const url = await signGetUrl(env, key, signingTtl);
  const expiresAt = Date.now() + nominalTtlSeconds * 1000;
  return { url, expiresAt };
}

The client's expiresAt is honest. The signed TTL just has a quiet cushion on top. One other thing worth knowing: mobile browsers behind aggressive proxy layers — I specifically noticed this in Korean carrier traffic — will reject presigned URLs with TTLs under 60 seconds. R2 itself allows down to 1 second, but the proxy doesn't care. Floor your TTLs at 60s if you have any mobile users outside North America or Europe.

I wrote up the full breakdown — including the Date.now() freezing behavior inside V8 isolates during cold starts (which caused a 1-2% silent 403 rate during a high-traffic campaign flush) and how to wire --persist-to locally so you can actually verify cross-restart URL validity — over on dailymanuallab.com.

Full post →