Interview Prep/AWS/Route 53, CloudFront, API Gateway and Messaging

A React SPA on S3 + CloudFront: `/` works, but refreshing `/dashboard/settings` returns `403 AccessDenied`.

IntermediateTroubleshootingRoute 53, CloudFront, API Gateway and Messaging
Answer

Likely causes → There is no S3 object at dashboard/settings. With OAC and no ListBucket, S3 returns 403 for missing keys, and the client-side router never loads.

Diagnose →

curl -sI https://app.example.com/dashboard/settings | head -3
aws cloudfront get-distribution-config --id E123ABC --query 'DistributionConfig.CustomErrorResponses'

Fix →

  1. Add custom error responses that map 403 and 404 to /index.html with response code 200
  2. Or (cleaner) use a CloudFront Function on viewer-request that rewrites paths with no file extension to /index.html, so real API 404s are not masked

Prevent → Make it part of your SPA hosting module, and keep APIs on a separate behavior or origin.

aws All AWS questions Roadmap: AWS core services

More on Route 53, CloudFront, API Gateway and Messaging