Topic lessonTopic: CloudFront: delivery, caching and 403 errors
Troubleshoot CloudFront 403: WAF, S3, aliases and viewer access
A 403 delivered through CloudFront does not identify the rejecting control by itself. Separate distribution settings, WAF, origin behavior and viewer authorization, then correlate observations for the same request. Establish the evidence before changing access settings.
Narrow 403 causes from observations, choose a safe investigation order and state what remains unproven.
HTTP 403 indicates a forbidden request. WAF applies web-request controls; OAC governs CloudFront access to an S3 origin. Logs here are fictional; do not enter real logs or credentials.
Compare the same hostname, path and time window
Possible causes include aliases, WAF, custom origins, S3 origins, geographic restrictions and signed URLs/cookies. An error seen through CloudFront is not automatically a CloudFront-only fault. Status alone does not distinguish WAF and origin 403 responses.
- Target request → Delivery and WAFReview authorized configuration and observations
- Target request → OriginCorrelate evidence if the request reached the origin
- Target request → Viewer accessCheck the required viewer authorization
- Target request
- Fix hostname, path and time
- Delivery and WAF
- Alias, restrictions and matched rules
- Origin
- Requested path and returned response
- Viewer access
- Signature, expiry and scope
Match each cause to its evidence
| Candidate | Evidence to inspect | Avoid this assumption |
|---|---|---|
| Custom domain | DNS target, distribution alias and hostname | Correct DNS proves distribution configuration. |
| WAF or geographic restriction | Controls matching the target request | Every 403 must be an S3 permission problem. |
| S3 origin | REST/website type, OAC, exact key/path and permissions | A missing key is always distinguishable as 404. |
| Custom origin | Received path, response and application access rules | Using a CDN guarantees an origin 200. |
| Signed URL/cookie | Required scope, expiry and other validity conditions | Invalidating the cache fixes invalid viewer authorization. |
An anonymous 403 at a private S3 REST origin can be expected protection. It is not the same test as an authorized CloudFront request. Check the exact object path, existence and OAC/permission alignment within your authorized access.
F1: when the origin response is known
Request: GET /reports/monthly.pdf, host=reports.example.com
Viewer response: 403
WAF observation: matching request ALLOW
Origin observation: matching request received; response 403
Object name in content inventory: /reports/Monthly.pdfF1 stipulates a WAF allow and a matching origin request returning 403. Start with origin path, resource and authorization. Monthly.pdf differs from the requested monthly.pdf. Investigate that exact key and its permissions; the spelling difference alone does not establish the sole cause.
| Additional observation | Next check | Still unproven |
|---|---|---|
| Matching WAF event is BLOCK | Matched rule and request legitimacy | Correctness of every origin setting. |
| Distribution configuration lacks the alias | DNS/distribution hostname alignment | Correct body delivery after the alias is fixed. |
| No origin entry; logging completeness unknown | Logging coverage, timing and delivery-side evidence | That the origin definitely received no request. |
Define evidence and scope before changing controls
- Fix hostname, exact path, time and intended viewer.
- Correlate the response with authorized delivery configuration/logs.
- Narrow WAF, alias, origin and signature candidates with evidence.
- Limit any change and identify its owner, approval and recovery.
- Retest intended content and requests that must remain denied.
Choose the next check from evidence
Choose an option to see the result and explanation.
Check, then explain in your own words
- Fix hostname, path, time and viewer conditions.
- Do not infer the source from status alone.
- Explain why F1 focuses on origin evidence.
- Retest both allowed and denied requests after any authorized fix.
Check your understanding: What should precede configuration changes for a 403?
The target request conditions and evidence that narrows the rejecting control.
Mixing different requests or incomplete logs can lead to removing valid protections.
Sources and conditions checked
The official references used in this lesson are collected here with their scope, conditions and corresponding sections. Independent expert review and live AWS comparison have not been performed.
Scope and conditionsLocate the 403 source across WAF, origin, aliases, paths and viewer authorization. Documentation review, not live AWS verification.
Used in this lessonCompare the same hostname, path and time window Match each cause to its evidence Choose the next check from evidence
Scope and conditionsDNS target, distribution alias and certificate SAN are separate checks; certificate wildcard scope. Documentation review, not live AWS verification.
Used in this lessonMatch each cause to its evidence
Scope and conditionsREST origin/OAC, always-sign behavior and distribution condition; no OAC on website custom origins. Documentation review, not live AWS verification.
Used in this lessonMatch each cause to its evidence Choose the next check from evidence
Scope and conditionsConfigured viewer status can differ from origin status. Documentation review, not live AWS verification.
Used in this lessonDefine evidence and scope before changing controls
Scope and conditionsHTTP success does not guarantee indexing; error content returned with 200 can be a soft 404. Documentation review, not live AWS verification.
Used in this lessonDefine evidence and scope before changing controls
Scope and conditionsMinimum/maximum/default TTL, validation, early eviction and positive-minimum safety boundary. Documentation review, not live AWS verification.
Used in this lessonDefine evidence and scope before changing controls