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 →
- Add custom error responses that map 403 and 404 to
/index.htmlwith response code 200 - 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.
More on Route 53, CloudFront, API Gateway and Messaging
You created a public hosted zone and records for `example.com`, but `dig example.com` returns `NXDOMAIN` or old records.Beginner`InvalidChangeBatch: RRSet of type CNAME with DNS name example.com. is not permitted at apex in zone example.com.`BeginnerThe primary Region is down, but Route 53 failover records still send traffic to it.IntermediateA Route 53 health check reports `Failure: Connection timed out` for an endpoint that works fine from your laptop.IntermediateYou changed an A record an hour ago, but some users still reach the old server, and a newly created name returned `NXDOMAIN` for a while.AdvancedCloudFront returns `403 AccessDenied` (S3 XML) for every object after you switched the S3 origin to Origin Access Control.Intermediate