INFRASTRUCTURE LEARNINGINFRASTRUCTURE LEARNING
インフラ大全インフラ大全IT INFRASTRUCTURE / LEARNING
Infrastructure learning guide
Find a lesson or lab/

Esc to close · Search terms stay on your device

LEARNING日本語

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.

What you will learn

Narrow 403 causes from observations, choose a safe investigation order and state what remains unproven.

Prerequisite

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.

Correlate separate rejection candidates, not a mandatory passage order
Correlate separate rejection candidates, not a mandatory passage order1: Target request — Review authorized configuration and observations — Delivery and WAF. 2: Target request — Correlate evidence if the request reached the origin — Origin. 3: Target request — Check the required viewer authorization — Viewer access123Target requestDelivery and WAFOriginViewer accessCorrelate separate rejection candidates, not a mandatory passage order1: Target request — Review authorized configuration and observations — Delivery and WAF. 2: Target request — Correlate evidence if the request reached the origin — Origin. 3: Target request — Check the required viewer authorization — Viewer access123Target requestDelivery andWAFOriginViewer access
  1. Target request → Delivery and WAFReview authorized configuration and observations
  2. Target request → OriginCorrelate evidence if the request reached the origin
  3. 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

403 candidates and checks
CandidateEvidence to inspectAvoid this assumption
Custom domainDNS target, distribution alias and hostnameCorrect DNS proves distribution configuration.
WAF or geographic restrictionControls matching the target requestEvery 403 must be an S3 permission problem.
S3 originREST/website type, OAC, exact key/path and permissionsA missing key is always distinguishable as 404.
Custom originReceived path, response and application access rulesUsing a CDN guarantees an origin 200.
Signed URL/cookieRequired scope, expiry and other validity conditionsInvalidating 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

F1: synthetic observations stipulated to match one request
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.pdf

F1 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.

Different evidence changes the next investigation
Additional observationNext checkStill unproven
Matching WAF event is BLOCKMatched rule and request legitimacyCorrectness of every origin setting.
Distribution configuration lacks the aliasDNS/distribution hostname alignmentCorrect body delivery after the alias is fixed.
No origin entry; logging completeness unknownLogging coverage, timing and delivery-side evidenceThat the origin definitely received no request.

Define evidence and scope before changing controls

  1. Fix hostname, exact path, time and intended viewer.
  2. Correlate the response with authorized delivery configuration/logs.
  3. Narrow WAF, alias, origin and signature candidates with evidence.
  4. Limit any change and identify its owner, approval and recovery.
  5. Retest intended content and requests that must remain denied.

Choose the next check from evidence

Choose an option to see the result and explanation.

A request through CloudFront returned 403. What follows from that alone?
Read the answer and reason

Answer: A refusal occurred; its source is not established · Correlate delivery, WAF, origin and viewer-authorization evidence.

What should F1 investigate first?
Read the answer and reason

Answer: The origin path, resource and authorization · The matching origin returned 403; correlate the key spelling difference and access conditions.

An anonymous request directly to private S3 returns 403. Does that prove OAC is broken?
Read the answer and reason

Answer: No; examine the authorized CloudFront request separately · The requester and path differ, so these are not equivalent tests.

Check, then explain in your own words

  1. Fix hostname, path, time and viewer conditions.
  2. Do not infer the source from status alone.
  3. Explain why F1 focuses on origin evidence.
  4. 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.