amplify-hosting
amplify-hosting copied to clipboard
Remove default Rewrites and redirects rules for Nuxt SSR
Before opening, please confirm:
- [X] I have checked to see if my question is addressed in the FAQ.
- [X] I have searched for duplicate or closed issues.
- [X] I have read the guide for submitting bug reports.
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- [X] I have removed any sensitive information from my code snippets and submission.
App Id
d1cs14y4x3ieze
AWS Region
ap-southeast-1
Amplify Hosting feature
Redirects, SSR
Frontend framework
Vue
Next.js version
Nuxt Version: 3.8.2
Next.js router
N/A
Describe the bug
Amplify has these Rewrites and redirects settings by default.
However, it's not working for a Nuxt SSR app, because nuxt build does not create any index.html file, it will keep redirecting to /index.html for every routes.
Expected behavior
These settings should not be set by default for Nuxt SRR applications.
Reproduction steps
- Init a Nuxt 3 repo.
- Create some pages, for example:
/login - Deploy to Amplify (https://aws.amazon.com/blogs/mobile/introducing-support-for-hosting-any-ssr-app-on-aws-amplify-hosting/)
- Visit the login page
main.<app-id>.amplifyapp.com/login
It redirect to /index.html, since this file does not exist it will show 404 error.
Build Settings
No response
Log output
# Put your logs below this line
Additional information
No response
Hi @trandaison :wave: !
Thanks for reaching out to us. To immediately unblock yourself, please remove the second rewrite rule from your app - It should prevent the 404 error from occurring.
Aside from that, could you please confirm if you have vue as a separate dependency in your package.json? If so, could you please explain your use case for that?
@Narrator Thanks for replying!
Thanks for reaching out to us. To immediately unblock yourself, please remove the second rewrite rule from your app - It should prevent the 404 error from occurring.
Actually, I had to remove all 2 rules, because the first one will cause redirect to /index.html when I visit the home page.
Aside from that, could you please confirm if you have vue as a separate dependency in your package.json? If so, could you please explain your use case for that?
Yes I do have vue in dependencies, I also have nuxt in devDependencies as well.
By default, nuxt create a package.json with both nuxt and vue as separate dependencies.