ServiceStack Static files handler
Attach raw HTTP handler at the AppHost level to serve static files from a folder or folders
RawHttpHandlers.Add(req =>
{
if (!allowedPaths.Any(z => req.PathInfo.ToLowerInvariant().StartsWith(z.ToLowerInvariant())))
{
return null;
}
if (!req.HttpMethod.EqualsIgnoreCase("GET"))
{
return null;
}
// Send back static file handler
return new StaticFileHandler
{
VirtualNode = VirtualFileSources.GetFile(req.PathInfo)
};
});