Next.js Discord

Discord Forum

refreshing some pages shows directory listing instead of expected content

Unanswered
Philippine Crocodile posted this in #help-forum
Open in Discord
Philippine CrocodileOP
I'm encountering a problem with my Next.js app after deploying it to AWS. When I refresh certain pages which initially load the expected content (like /baseurl/events/admin), instead of reloading the expected content, I'm seeing a directory listing (e.g., showing files like events.html, tags.html, etc.). Additionally, I occasionally get 404 errors for files like events.txt.

Next.js Configuration:
- Using output: 'export' for static export.
- The app is served from an S3 bucket

-Deployment Process:
- CI/CD pipeline uses next build and next export to generate the static files, which are then deployed to S3.

Problem:
- After refreshing a page, the directory listing appears instead of the expected content.
- Sometimes a 404 error occurs for non-existent files like events.txt.

What I've Tried:
- Ensured all necessary files are included in the deployment.

Looking for Advice On:
- Why might these directory listings appear after a refresh?
- How can I ensure that S3/CloudFront correctly handles requests without falling back to directory listings?
- Any other configurations or best practices I might be missing?

0 Replies