Question

Digital ocean apps - SPA application

Hi, I managed to setup angular application in App platform as static site. The problem is, that I cant setup redirect all paths to index.html

Is it possible to run SPA application in App platform using static sites?

Thank you

Show comments

Submit an answer


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!

Sign In or Sign Up to Answer

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.

Accepted Answer

It looks like you can set up each route in “Components/HTTP Routes”, but I don’t see an easy was to set a catch-all. Perhaps overriding the static_sites/error_document key would do it (as referenced here: https://www.digitalocean.com/docs/app-platform/references/app-specification-reference/ ) but I’m assuming that is responding with a 404, which wouldn’t be good.

Mod edit: we have since added support for “Catchall Documents”. In your Static Site settings, you will have the option to choose a file (e.g. index.html) that all inexistent paths are routed to with a 200 OK status code.

You can use “catchall_document: index.html”

Jon Friesen
DigitalOcean Employee
DigitalOcean Employee badge
October 13, 2020

👋 @raold

App Platform does not currently have the functionality to redirect but it’s something we’re looking into.

As a workaround, your Angular app should support routing which will allow you to put a catch-all route.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel