This project reproduces the issue described in amplify-js#14606 where Nuxt prerendered pages fail to load on refresh when hosted on AWS Amplify.
When a Nuxt app is deployed to Amplify Hosting with prerendered routes:
- Accessing
/static-test/index.htmlworks correctly (200 OK) - Accessing
/static-testfails with 502 Bad Gateway on refresh - The server tries to find the file at
/static/test-static/index.htmlbut it's not there
- Install dependencies:
npm install- Build the project:
npm run build- Deploy this app to AWS Amplify Hosting
- Navigate to the deployed URL
- Click "Go to Static Test Page" to navigate to
/static-test - Refresh the page while on
/static-test - Observe the 502 Bad Gateway error
The /static-test route should serve the prerendered HTML content without errors, just like /static-test/index.html does.
The key configuration in nuxt.config.ts:
nitro: {
preset: 'aws-amplify',
awsAmplify: {
catchAllStaticFallback: true
},
routeRules: {
'/static-test': { prerender: true }
}
}This configuration should prerender the /static-test route as static HTML, but the routing fails when accessed without the explicit /index.html suffix.