> For the complete documentation index, see [llms.txt](https://cortex-docs.paloaltonetworks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cortex-docs.paloaltonetworks.com/appsec-rules/iac-security/public-exposure/appsec-aws-305.md).

# AWS CloudFront distributions does not have a default root object configured misconfiguration detecte

## Rule Details

|                        |                                      |
| ---------------------- | ------------------------------------ |
| Cortex AppSec Rule ID  | APPSEC\_AWS\_305                     |
| Category - Subcategory | Public Exposure - Load Balancing     |
| Provider               | AWS                                  |
| Severity               | MEDIUM                               |
| Framework              | Terraform, Terraform Plan            |
| Mapped CSPM/KSPM Rule  | ad2b6315-66d2-4e1c-9fb8-ec28349aeeee |

## Impact

This rule is checking if a default root object has been configured for Cloudfront distribution in Amazon Web Services (AWS). If not properly configured, it may lead to an undesirable user experience. For example, if a user requests the root URL of your distribution and a root object is not set, Cloudfront returns an XML document that lists contents of the distribution. This is not only unprofessional, but it could potentially expose sensitive information about the infrastructure of your website. Therefore, a default root object, such as index.html, should be configured to provide a more controlled and secure user experience.

## How to Fix

*Resource:* aws\_cloudfront\_distribution

* *Arguments:* default\_root\_object

## To fix this issue, you need to set a default root object in your Cloudfront distribution. \[source,go]

## resource "aws\_cloudfront\_distribution" "s3\_distribution" { .... default\_root\_object = "index.html" .... }


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://cortex-docs.paloaltonetworks.com/appsec-rules/iac-security/public-exposure/appsec-aws-305.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
