Owin UseStaticFiles not respecting RequestPath

owin

Solution

I tested this code snippet and it works for me from this sample project.

app.UseFileServer(new FileServerOptions()
{
    RequestPath = new PathString("/foo"),
    FileSystem = new PhysicalFileSystem(@".\web"),
});

Make sure you have this in your web.config:

<system.webServer>
    ...
    <modules runAllManagedModulesForAllRequests="true"></modules>
    ...
</system.webServer>

Problem

**EDIT: NOTE: This appears to be fixed in later versions of the Owin StaticFiles middleware, so if you have this probem, simply upgrade ** My OWIN configuration has this:- ``` string root = AppDomain.CurrentDomain.BaseDirectory; var staticFilesOptions = new StaticFileOptions(); staticFilesOptions.RequestPath = new PathString("/foo"); staticFilesOptions.FileSystem = new PhysicalFileSystem(Path.Combine(root, "web")); app.UseStaticFiles(staticFilesOptions); ``` When I hit `/foo/app/app.js` I get a 404 error, when I hit `/web/app/app.js` the file is returned. How is `RequestPath` meant to work in conjunction with `PhysicalFileSystem`?

Original source