Question

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

Posted October 8, 2021 104 views
MEANJavaScriptAngularDigitalOcean App Platform

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?

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.

×
Submit an Answer
1 answer

Hello @khanpham1995 ,

We understand that you are experiencing a 404 error on the app due to a routing issue. You have to set the catchalldocument to index.html to fix this issue. There are 2 methods to set the catchalldocument.

=======

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