Question

[App Platform] Deploy multiple SPA on same app platform issue

Currently, I’m deploying my MEAN app to DO App Platform. I’ve deployed one angular static component and one expressjs server as web service component. Everything works fine, my angular component can call api from the service. But, when I add another angular static component ( which has a different route to the first angular component), I can not go to the second angular component. Every time I go to the second angular component, I get 404.

First angular component : route : / Output Directory : dist/abc

Second angular component : route : /client OutputDirectory : dist/def

express component : route : /service

I’ve tried to add Custom Pages as index.html for the first angular component , 404 error gone but then it not gonna render the second angular component.

The first angular component serves as user site while the second angular component serves as cms site.

Can anyone help me on this please?


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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hello @khanpham1995 ,

We 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.

=======

  1. 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

  2. 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