// troubleshooting guide · aws cloudfront
CloudFront 502 Bad Gateway Error
- Status
- Workaround available
- platforms:
- AWS Console, custom origins (EC2, ALB, external servers)
- updated:
- November 17, 2026
- reports:
- 5
- Method
- how we research
RUNBOOK · aws-cloudfront/502-bad-gateway4 FIXES
// quick answer
CloudFront returns 502 when it can't complete a valid connection to your origin: most often the origin's TLS certificate doesn't match the origin domain, is expired, self-signed or missing intermediates, or the origin DNS doesn't resolve. Fix the certificate or the Host header forwarding.
Most likely fix: Test the origin TLS handshake
How to fix it
// try these in order, the most common fix is first
FIX 1Test the origin TLS handshake
- 01Run openssl s_client -connect origin.example.com:443 -servername origin.example.com
- 02Check the certificate covers the origin hostname, isn't expired and that the chain includes intermediates
- 03Replace or reissue the certificate if needed
Did this fix it?FIX 2Stop forwarding the viewer Host header
- 01Open Behaviors > Edit
- 02Change the origin request policy from AllViewer to AllViewerExceptHostHeader
- 03Save and retest
Did this fix it?FIX 3Check origin protocol settings
- 01Open Origins > Edit
- 02Confirm Protocol (HTTPS only / Match viewer) and HTTPS port match the origin
- 03Set Minimum origin SSL protocol to a version the origin supports (TLSv1.2)
Did this fix it?FIX 4Verify DNS for the origin
- 01Run dig origin.example.com from outside your network
- 02Make sure it resolves publicly; private DNS names need VPC origins
Did this fix it?
Symptoms
502 ERROR 'The request could not be satisfied. CloudFront wasn't able to connect to the origin.'
Why it happens
- C-01Origin certificate doesn't include the Origin domain name configured in CloudFront
- C-02Expired, self-signed or incomplete certificate chain on the origin
- C-03Origin only supports TLS versions or ciphers CloudFront doesn't accept
- C-04Viewer Host header forwarded to an origin whose certificate doesn't cover it
- C-05Origin domain name doesn't resolve in public DNS
- C-06Lambda@Edge function returned an invalid response
// this guide also covers
- cloudfront 502 bad gateway
- cloudfront wasn't able to connect to the origin
- cloudfront 502 ssl
- cloudfront 502 error
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 504 Gateway Timeout Error
- CloudFront React App 403/404 on Page Refresh
- Why Is My CloudFront Bill So High?