I'm trying to serve 2 angular apps from my .net core service like this:
public void ConfigureServices(IServiceCollection services)
{
...
services.AddSpaStaticFiles(configuration =>
{
configuration.RootPath = "wwwroot/app";
});
services.AddSpaStaticFiles(configuration =>
{
configuration.RootPath = "wwwroot/admin";
});
...
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
...
app.UseSpaStaticFiles(new StaticFileOptions
{
OnPrepareResponse = ctx =>
{
ctx.Context.Response.Headers.Append("Cache-Control", "public,max-age=0");
}
});
app.UseMvc();
app.Map("/app", client =>
{
client.UseSpa(spa =>
{
spa.Options.SourcePath = "wwwroot/app";
});
}).Map("/admin", admin =>
{
admin.UseSpa(spa =>
{
spa.Options.SourcePath = "wwwroot/admin";
});
});
}
in the file system, I only have the dist
output of these apps (since they are developed by another team). So it looks like this:
- C:[MY PROJECT PATH]\wwwroot\app
- C:[MY PROJECT PATH]\wwwroot\admin
But for some reason, the admin app works and the app doesn't and also it doesn't support a default page so I need to enter the URL with /index.html
.
Any ideas on how to solve this?