I have smoothly deployed a VueJS app on a DO App as Static Site. App and routes works fine. But there is one major problem, when someone tries to access router link directly or refresh the page - app throws 404 error.
I have found in VueJS official documentation info that I should create catch-all fallback on the server side: HTML5 History Mode Unfortunately I have no clue how to implement it on DO App. Should it be some modification to App Spec file?
Anyone here have some solution for this problem?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hello @askAxolotl ,
I understand that you are experiencing a 404 error on the app due to a routing issue. You have to set the catchall_document to index.html to fix this issue. There are 2 methods to set the catchall_document.
Using Cloud panel UI: Log in and click on App > Settings >> click on component name > scroll down to Custom page > Edit Custom page and select Catchall > Enter index.html in the page name block > save
Using App Spec: You can the catchall_document to index.html in-app spec.
Here’s the documentation link which will help you in updating your app: https://www.digitalocean.com/docs/app-platform/references/app-specification-reference/ https://www.digitalocean.com/docs/app-platform/references/command-line/
We have discussed a similar issue in our community link below: https://www.digitalocean.com/community/questions/react-router-and-app-platform-problems?answer=64988 https://www.digitalocean.com/community/questions/digital-ocean-apps-spa-application
Hope this helps!
Cheers, Sri Charan