// troubleshooting guide · aws cloudfront
CloudFront React App 403/404 on Page Refresh
- Status
- Workaround available
- platforms:
- React, Vue, Angular, Next.js static export
- updated:
- November 17, 2026
- reports:
- 5
- Method
- how we research
RUNBOOK · aws-cloudfront/spa-403-on-refresh3 FIXES
// quick answer
Refreshing a client-side route (like /dashboard) on an S3 + CloudFront SPA returns 403 because no S3 object exists at that path. Map 403 and 404 to /index.html with status 200, or rewrite routes with a CloudFront Function.
Most likely fix: Add custom error responses
How to fix it
// try these in order, the most common fix is first
FIX 1Add custom error responses
- 01Open the distribution > Error pages > Create custom error response
- 02HTTP error code 403, Customize error response Yes, Response page path /index.html, HTTP response code 200
- 03Repeat for 404
- 04Set Error caching minimum TTL low (e.g. 0-10 seconds) while testing
Did this fix it?FIX 2Rewrite routes with a CloudFront Function
- 01Open CloudFront > Functions > Create function
- 02Write a viewer-request handler that sets request.uri to /index.html when the path has no file extension
- 03Publish it and associate it with the default behavior as Viewer request
Did this fix it?FIX 3Keep real 404s for API or asset paths
- 01Put APIs on a separate cache behavior or origin
- 02Prefer the CloudFront Function approach, since custom error responses apply to the whole distribution
Did this fix it?
Symptoms
Home page loads, but refreshing or opening a deep link returns AccessDenied XML or a 404.
Why it happens
- C-01S3 has no object for client-side routes and returns 403 (or 404 with ListBucket)
- C-02No custom error response or URL rewrite configured
- C-03Error caching TTL keeps serving the old error after a fix
// this guide also covers
- cloudfront react refresh 403
- cloudfront spa 404 on refresh
- s3 cloudfront react router
- cloudfront single page application routing
Still not working?
If AWS CloudFront keeps failing, you're not alone. See every AWS CloudFront problem users report or the alternatives people switch to.
Have an app idea? Our small team builds any software: web and mobile apps, games, desktop, AI tools. Price agreed together.
Talk to usThe same problem in other apps
All not loading, error messages & connection guides →
Cloudflare Error 521: Web Server Is Down (Cloudflare)
Fastly Error: Unknown Domain (Fastly)
Google Cloud Quota Exceeded Error (Google Cloud)
Netlify Page Not Found on Refresh (SPA 404) (Netlify)
Other AWS CloudFront errors
- CloudFront 403 Access Denied With S3 Origin
- CloudFront 403 Error: The Request Could Not Be Satisfied
- CloudFront Invalidation Not Working (Still Serving Old Content)
- CloudFront CORS Error: No 'Access-Control-Allow-Origin' Header
- CloudFront SSL Certificate Not Showing (ACM us-east-1)
- CloudFront 502 Bad Gateway Error
- CloudFront 504 Gateway Timeout Error
- Why Is My CloudFront Bill So High?