Skip to content

Persistent CloudFront Involvement Causing 403 Forbidden Errors Despite cloudfront: false in Zappa Deployment

0

I am using Zappa to deploy a Flask application on API Gateway and Lambda. Despite setting "cloudfront: false" in my zappa_settings.json and redeploying with a new project name, CloudFront is still intercepting my requests, causing 403 Forbidden errors for certain paths (/shorten and /favicon.ico). The response headers include "Via: 2.0 dfd34e1e01b522d0fbbf77a5352081ce.cloudfront.net (CloudFront)" and "X-Cache: Error from cloudfront". However, when I run "aws cloudfront list-distributions", no distributions are listed, suggesting the distribution might be in a different account, region, or not accessible to my credentials (zappa-deployer). I need assistance to identify and remove this CloudFront distribution so that requests go directly to API Gateway

1 Answer
1

By default, API Gateway in edge-optimized mode uses CloudFront under the hood, even if you haven’t explicitly created or listed a CloudFront distribution. This behavior happens because API Gateway edge-optimized endpoints are automatically deployed to global CloudFront edge locations for performance and latency reasons. You can try switching to Regional API Endpoint.

AWS

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.