Menu

A Complete Guide to AWS CloudFront Origin Request Policies
πŸ“°

A Complete Guide to AWS CloudFront Origin Request Policies

DEV Community: aws·Maciej Łopalewski·12 days ago
#zXk2IKHQ
#devtoaws#devto#dev#origin#policy
Reading 0:00
15s threshold

If your origin needs data the cache key shouldn't include, an origin request policy is the right tool. It controls what CloudFront forwards to your backend on a cache miss, separately from what makes a request "unique" for caching. Use a managed policy unless you have a specific reason not to β€” AWS ships eight of them, and most distributions can pick one off the shelf.

The short version, before the rest of the article:

Managed policy Use when your origin is

AllViewer A backend that needs every viewer header, cookie, and query string

AllViewerAndCloudFrontHeaders-2022-06 The same, plus geolocation, device-type, or TLS metadata

AllViewerExceptHostHeader API Gateway or a Lambda function URL

CORS-S3Origin An S3 bucket serving cross-origin assets

CORS-CustomOrigin A non-S3 web server handling CORS

HostHeaderOnly A backend that needs only the original Host header

UserAgentRefererHeaders Doing analytics, hotlink protection, or basic device detection

Elemental-MediaTailor-PersonalizedManifests An AWS…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.