I\'m making a SPA which sits on top of ASP.Net WebAPI. I\'m waiting to use HTML5 history rather than #/
for history routing but that poses a problem for deep linkin
To make things simple, while still keeping all the caching goodness etc. from the StaticFiles middleware, I'd just rewrite the request path using an inline middleware, like this
public class Startup
{
public void Configuration(IAppBuilder app)
{
app.Map("/app", spa =>
{
spa.Use((context, next) =>
{
context.Request.Path = new PathString("/index.html");
return next();
});
spa.UseStaticFiles();
});
app.UseWelcomePage();
}
}
This will serve the welcome page on anything but /app/*
, which will always serve index.html instead.