can i run, in one single app service, my java API as a virtual application under /api and my frontend angular SPA on under / ?
in my application settings:
- i've set Java to version 8
- i've set the web container to Tomcat 9
- in the virtual application section i have:
- virtual directory: / and path: site\wwwroot
- virtual directory: /api and path: site\wwwroot\api
- both are marked as Application
After i deploy both virtual apps, when i go to the app service URL, i get the frontend correctly, but there is also a call to the API which stays in pending for a couple of minutes and then ends in a 500 error. If i try to access the API directly, i get the same 500 error.
The API was built with Spring and it's web.config file i have set:
<applicationInitialization doAppInitAfterRestart="true">
<add initializationPage="/api"/>
<add initializationPage="/api/health"/>
<add initializationPage="/api/info"/>
</applicationInitialization>
I want both, API and SPA, to be on the same domain. Currently, API is accessible from any domain, no restrictions on it.
What am i doing wrong? How can i make it work?