Path-Style URL with Global S3 Endpoint
Parse a path-style S3 URL that uses the global s3.amazonaws.com endpoint without a region. Understand the redirect behavior for non-us-east-1 buckets.
Detailed Explanation
Path-Style with the Global Endpoint
When a path-style URL uses the global endpoint (s3.amazonaws.com) without a region prefix, the behavior depends on where the bucket is located.
URL Structure
https://s3.amazonaws.com/BUCKET/KEY
Example
https://s3.amazonaws.com/shared-assets/fonts/inter-variable.woff2
Parsed Components
| Component | Value |
|---|---|
| Bucket | shared-assets |
| Key | fonts/inter-variable.woff2 |
| Region | (not specified) |
| Style | Path Style |
Redirect Behavior
For path-style requests to the global endpoint:
| Bucket Region | Behavior |
|---|---|
us-east-1 |
Request is served directly — no redirect |
| Any other region | S3 returns 301 Moved Permanently to the regional endpoint |
Note the difference from virtual-hosted style redirects: path-style returns a permanent 301 redirect, while virtual-hosted style returns a temporary 307 redirect.
The 301 Redirect Response
HTTP/1.1 301 Moved Permanently
Location: https://s3.eu-west-1.amazonaws.com/shared-assets/fonts/inter-variable.woff2
Why This Matters
- Caching: CDNs and browsers may cache 301 redirects permanently, which can cause issues if the bucket is moved or deleted.
- CORS: The redirect may break cross-origin requests if CORS is not configured on the regional endpoint.
- Performance: An extra round-trip for every request adds latency.
Always specify the region explicitly in production URLs to avoid these issues.
Use Case
Diagnosing why an application deployed in eu-west-1 experiences high latency when fetching S3 assets via the global endpoint, discovering the 301 redirect chain adds unnecessary round-trips.