Add support for virtual directories
daveaglick opened this issue · comments
It can be useful to serve a site behind a virtual directory when testing it if that's where it'll be served from in production. Otherwise, absolute links that contain the parent directories won't work correctly when served locally.
For example, if a file exists on disk at "/a/b.html" but it'll end up being served behind a username root folder like "/daveaglick/a/b.html", then being able to serve the site locally behind the same root folder becomes important.
I propose the feature should be opt-in behind a CLI option -v|--virtual <VIRTUAL PATH>
.
I'm thinking that like #1, this feature would also require custom middleware. As with the extensionless URLs feature, I've already got an implementation in Wyam that could hopefully be ported without too much trouble (https://github.com/Wyamio/Wyam/blob/develop/src/core/Wyam.Hosting/Owin/VirtualDirectoryMiddleware.cs).
Some of this can already be achieved with .UsePathBase(). Maybe --path-base <PATH>
?