Do CloudFront distributions for Appsync APIs need a default root object?


I have an Appsync API that is set up as the origin of a CloudFront distribution (so that we can have a custom domain name, among other things).

This origin is set as the default (*) behaviour for the distribution.

Security Hub complains that it fails [Cloudfront.1] "CloudFront distributions should have a default root object configured"

But if I add a default root object, it breaks the API. GraphQL POST requests to the domain get rejected with an UnknownOperationException error.

My question is, is this security rule relevant for a CF distribution that only has an Appsync origin? Can I just suppress it?

1 Answer

If certain security hub findings are not relevant in your use cases, you can definitely suppress those type of findings. Follow this blog post, which explains how to create auto suppression rules.

Purpose of this specific rule CloudFront.1 is to avoid exposure of your web distribution content, if a user requests distribution's root URL instead of an object in the distribution.

Since you have already tried setting up default root object, so you must be already aware of this, but still I'm mentioning here, how to do that just in case nothing is missed:

       General Tab > Settings section > Edit > scroll down to Default root object > enter index.html.

Hope you find this useful.


profile pictureAWS
answered 9 months 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.

Guidelines for Answering Questions