TLS and origin protection
Two TLS connections, two trust checks
A public edge can serve a site while its origin remains private or otherwise restricted. The client connects to the edge; on a miss the edge connects to the origin. TLS protects traffic in transit and authenticates a server identity when certificates are validated. If the edge terminates HTTPS and establishes a new HTTPS connection upstream, these are two distinct TLS sessions, not one end-to-end TLS tunnel. Both must be configured and verified.
For shop.example.com, the viewer certificate must cover that hostname and be trusted and valid. For the edge-to-origin connection, configure the expected origin hostname, certificate and trust according to the provider. A healthy viewer certificate cannot fix an invalid upstream certificate. Never disable origin hostname validation to work around an error. Certificate rotation includes checking expiry, chain, name coverage and both connections before retiring old material.
Restrict direct access without hiding public content
A public bookstore cover is intended for everyone through the edge. That does not mean the storage bucket needs anonymous access. Permit the edge service identity or a supported private network path to reach the origin, limit permissions to necessary resources and operations, and reject direct unauthenticated origin requests. Origin restriction is not the same as viewer authorization: private receipts still need per-user access checks even if the origin cannot be accessed directly.
For a supported Amazon S3 bucket origin, CloudFront Origin Access Control (OAC) can authenticate origin requests. Use the regular bucket endpoint, not the S3 website endpoint, for this OAC design. Keep public bucket access blocked, with narrowly scoped permission for the intended distribution; review encryption-key permissions if needed. Azure Front Door Premium supports Private Link for eligible origins and regions; establish and approve the connection and restrict alternate public access as applicable. Google Cloud CDN supports signed viewer requests and selected private-origin authentication arrangements; its supported origin types and authorization mechanisms must be checked separately. Do not equate signed viewer URLs, origin authentication and private network connectivity.
Separate public and private cache behavior
Use public caching only for content proven safe to share. For the fictional /covers/ path, allow cacheable GET responses with a stable key. For /account/receipt, require authenticated application access and configure the edge to bypass shared caching; the origin returns Cache-Control: private, no-store. Never include real tokens, personal information or signed URLs in logs. Reject a receipt request for the wrong account even if the network connection is allowed.
An origin response header is not a substitute for checking CDN policy: CloudFront with a positive minimum TTL can retain responses despite origin privacy directives, and Google Cloud CDN force-cache modes may override them. Use a policy that disables shared caching for personalized routes, check rules and precedence, and use two synthetic users to confirm each receives only their own content. If sensitive data was incorrectly cached, stop unsafe reuse, scope invalidation, review logs and follow incident procedures; do not assume purge alone eliminates all exposure.
Work through an offline acceptance matrix
Assume the viewer certificate and origin certificate are trusted, the origin authorizes the edge and direct anonymous origin reads are denied. A public cover miss should return 200 from the origin; a fresh edge hit should return 200 without a new origin request. A direct anonymous request should return a denial (403 in this toy model). An authenticated receipt for its owner should return 200 without being shared; a different user should receive a denial. If upstream TLS validation fails, the edge reports an origin connection failure on a miss rather than silently accepting the certificate; exact HTTP status depends on the provider. An existing fresh hit can still succeed, which is why testing only cached objects is inadequate.
For troubleshooting, record expected versus observed DNS target, viewer TLS, cache status, upstream TLS, origin policy and application authorization. Distinguish an edge-generated denial from an origin-generated denial. Use correlation IDs without credentials and verify health on uncached paths. Monitor certificate expiration, hit ratio, origin error rate and latency, with privacy-aware retention.
Plan a safe release and rollback
Start with a synthetic origin containing one versioned public cover and two fake receipts. Document routes, cache policy, expected hostnames, permissions and resource owner. In an authorized lab only, check that the edge can fetch the public object, direct origin access is denied, both TLS legs validate, and receipt responses never appear in shared cache. Test both cache hits and misses; a policy change may not affect already cached entries until expiry or invalidation. Do not use real domains, certificates, account data or paid services for the compulsory exercise.
For a release, upload versioned assets before publishing the new HTML; retain the old versions during rollback. If the new origin fails, restore the reviewed configuration and verify uncached requests, then assess whether targeted invalidation is required. Review DNS TTL separately. An eventual live lab needs a cost estimate for requests, delivery, logs, origin storage and private connectivity, plus scoped cleanup of lab-owned resources. The current task is entirely offline.
Practice: protect the bookstore
Draw the request path as text: browser to edge over validated TLS; edge to restricted origin over validated TLS with an allowed service identity or private path. Mark the public cache route separately from the uncached receipt route. Predict five outcomes: a public miss, a public hit, direct origin access, a receipt request by the wrong user and a miss with invalid origin TLS. Explain why the two certificates, access controls and cache settings are independent. Compare the results with the manual task rubric; no provider credentials are needed.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
TLS and origin protection — knowledge check
Choose the best answer for each offline scenario.
The viewer certificate is valid but upstream TLS name validation fails on a miss. What should the edge do?
Which S3 origin fits the CloudFront OAC bucket design?
A public CDN fronts private receipts. What else is required?
Which Front Door tier supports Private Link for eligible origins?
Why test a fresh hit and an uncached request?