published fresh until

My S3 presigned PUT upload returns 403: what do I check?

Summary As of November 2026, a presigned S3 PUT can return 403 or SignatureDoesNotMatch when request headers (especially Content-Type) differ from the ones signed, the signing credentials lack s3:PutObject, or the URL outlived temporary credentials. Match headers exactly and test with curl first.

Not for 413 payload too large before reaching S3, see upload-413-direct-to-s3-r2-presigned

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

The problem

Your server hands the browser a presigned S3 URL, the browser does PUT with the file, and S3 answers 403 (often with SignatureDoesNotMatch). Generating the URL raised no error, so it looks like S3 is broken. A signature mismatch can occur when the request does not match what was signed.

What the sources say

  • Stack Overflow, "Testing a AWS S3 Presigned Url returns 403 Forbidden (Nodejs)" (asked by NJones): one answer (Shahar Yakov) says the request headers must match those used when signing, and that some HTTP libraries add default headers such as Content-Type (Axios does). Another (jocelyn) warns that if the code signing the URL lacks the right IAM permission you get no error at signing time, only when the URL is used. The asker found it worked from Postman with PUT and a binary body.
  • Stack Overflow, "Presigned AWS S3 PUT url fails to upload from client using jquery" (asked by kungfoo): the accepted answer (jeremy) signs with a ContentType and sends exactly the same Content-Type header from the client. A later answer (SMX) adds a minimal CORS rule that allows PUT and the Content-* and Authorization headers from your own origin.
  • AWS docs, "Download and upload objects with presigned URLs": a presigned URL cannot be valid longer than the credentials that signed it; with IAM role or STS credentials the URL stops working when the session expires, even if you asked for a longer expiry.

What to do

1. Test the URL outside the browser: curl -X PUT -H "Content-Type: <same type>" --data-binary @file "<url>". If curl works, compare the browser request with the curl request. 2. Compare headers: whatever you passed when signing (ContentType, checksum, ACL) must be sent identically. Do not send extra signed-header values the server did not sign. 3. Check the signer's IAM policy allows s3:PutObject on that key. 4. Check expiry against the credential lifetime (roles, STS). 5. If the browser shows a CORS error instead, add a CORS rule on the bucket for your origin and the PUT method.

How to describe it to your agent

My presigned S3 PUT returns 403. Print the headers the signer used and the headers the client sends, and list differences. Test the URL with curl using a tiny file. Never paste real access keys or a full presigned URL into chat or logs; redact the query string.

Mistakes to check

  • Signing with one Content-Type and letting the browser or Axios send another.
  • Signing credentials without s3:PutObject, or a role session that expires first.
  • Logging the full presigned URL; the signature in it grants access until it expires.

Limits

I did not run these steps myself. The Stack Overflow answers date from 2015 to 2021, so I leaned on the AWS documentation for expiry; check SDK-specific header behavior in your SDK's current docs.

Started from a post by @AWS documentation; NJones, kungfoo, Shahar Yakov, jeremy (Stack Overflow), packaged by the editor. Original post

Subjects

More in documentation

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# My S3 presigned PUT upload returns 403: what do I check?
Summary: As of November 2026, a presigned S3 PUT can return 403 or SignatureDoesNotMatch when request headers (especially Content-Type) differ from the ones signed, the signing credentials lack s3:PutObject, or the URL outlived temporary credentials. Match headers exactly and test with curl first.
Copy for agent
get the whatworks thread s3-presigned-put-upload-403-signature-does-not-match-headers-iam-expiry and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread s3-presigned-put-upload-403-signature-does-not-match-headers-iam-expiry
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks