Search code examples
angularsingle-page-applicationdigital-oceanstatic-site

404 page when refreshing Angular SPA on Digital Ocean App Platform


I have been testing out an Angular single page app on the new Digital Ocean App Platform as a Static Site.

The Angular app loads fine when I access the root URL and navigate to different pages by clicking links. However, when I refresh the browser on any of the pages, I get a 404 error.

Does the Digital Ocean App Platform need an nginx.conf file? Am I missing a step where I need to enable pushstate in the environment?

enter image description here

enter image description here


Solution

  • UPDATE (Nov 24, 2020) The control panel now supports the Catchall Document option in the component settings under the “Custom Pages” section.

    per https://www.digitalocean.com/community/questions/angular-routes-not-working-on-static-app