Skip to content

Instantly share code, notes, and snippets.

@dibble-james
Created April 9, 2016 21:12
Show Gist options
  • Save dibble-james/f47b0cba3494381588482c7f185861bf to your computer and use it in GitHub Desktop.
Save dibble-james/f47b0cba3494381588482c7f185861bf to your computer and use it in GitHub Desktop.
OWIN Middleware configuration for use with LetsEncrypt
using Microsoft.Owin;
using Microsoft.Owin.FileSystems;
using Owin;
using Umbraco.Web;
public class Startup : UmbracoDefaultOwinStartup
{
public override void Configuration(IAppBuilder app)
{
app.Map("/.well-known", letsEncrypt =>
{
letsEncrypt.Use((context, next) =>
{
IFileInfo file;
var fileSystem = new PhysicalFileSystem(@".\.well-known");
if (!fileSystem.TryGetFileInfo(context.Request.Path.Value, out file))
{
return next();
}
return context.Response.SendFileAsync(file.PhysicalPath);
});
});
base.Configuration(app);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment