2 Answers
- Newest
- Most votes
- Most comments
0
It's unclear from your post and comment what the function is doing, and what part you're having trouble with - or even if the function is throwing errors at all. There are some sample functions available on aws-samples which might help you get started.
For troubleshooting, I would start by removing the function association from your CloudFront behavior and making sure that all your CloudFront configuration is working as expected. Then add the function back in - perhaps adding one piece of functionality at a time so that you can easily identify the cause of any problems you encounter.
-2
Here are a few suggestions to help integrate your Flask application with CloudFront:
- Ensure the origin of your CloudFront distribution is configured as a REST API endpoint rather than a website endpoint. The REST API endpoint allows you to specify custom HTTP methods like POST that may be required by your Flask application.
- Check that the HTTP methods allowed on your CloudFront distribution match those required by your Flask application. You can modify the allowed methods in the CloudFront console or via the AWS CLI.
- Consider using AWS WAF with CloudFront to restrict access to your Flask application only from the CloudFront distribution. This provides an extra layer of security compared to using origin access identity alone.
- If you are experiencing SSL issues between clients and CloudFront, ensure you have requested an ACM certificate for your custom domain and associated it with the distribution. You may also need to check redirection policies on your Flask application.
Relevant content
- asked 2 years ago
- asked 4 months ago
- asked 7 years ago
- asked 6 months ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated a month ago
What is it, exactly, that you're trying to send to the origin from a Function, and how are you trying to do it? I'd suggest you remove the function and make sure everything is working correctly first, before trying to add it as it sounds like there may be multiple problems here.
I'm sending over mostly a blank JSON object with the returned value as part of a header, if that makes sense. In regards to your suggestion, do you just mean disassociating it from the behavior?