Created
April 9, 2016 21:12
-
-
Save dibble-james/f47b0cba3494381588482c7f185861bf to your computer and use it in GitHub Desktop.
OWIN Middleware configuration for use with LetsEncrypt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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