Same-host vs CDN

Default same-host URLs vs public_base_url rewrite modes.

Default: same-host

With public_base_url empty (default):

  1. WordPress keeps advertising /wp-content/uploads/... on your site domain.
  2. If the file exists locally, PHP/nginx serves it as usual.
  3. If missing, the plugin streams the object from S3 (response header X-WP-To-S3: 1).
  4. Optional: WP_TO_S3_REDIRECT_MISSING for a 302 to a public or presigned S3 URL.
  5. You can put Cloudflare (or similar) in front of the site to cache same-host media.

No forced rewrite to provider hostnames.

Optional: public_base_url

When WP_TO_S3_PUBLIC_BASE_URL (or Media → WP to S3 → Public base URL) is set:

Example:

Uploads base:  https://example.com/wp-content/uploads
public_base:   https://cdn.example.com/media
Attachment:    https://cdn.example.com/media/2020/03/foo.jpg
Object key:    2020/03/foo.jpg  (plus optional prefix)

Historic post content

Old post HTML may still contain absolute https://example.com/wp-content/uploads/... links.

Choosing a mode

GoalRecommendation
Simplest cutover, no DNS/CDN workSame-host stream (default)
Offload bandwidth from originSame-host + CDN caching your domain
Direct public bucket or custom media domainSet public_base_url (+ optional content rewrite)