From 5e0668077fc50ed2a6aa9f25f50a97bee21d7891 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 7 Aug 2018 15:04:11 -0400 Subject: [PATCH] special config for webVault --- util/Server/Startup.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/util/Server/Startup.cs b/util/Server/Startup.cs index 546f5b2ece..a32b2ac2c9 100644 --- a/util/Server/Startup.cs +++ b/util/Server/Startup.cs @@ -31,8 +31,7 @@ namespace Bit.Server .AddConsole() .AddDebug(); - var serveUnknown = configuration.GetValue("serveUnknown") ?? false; - if(serveUnknown) + if(configuration.GetValue("serveUnknown") ?? false) { app.UseStaticFiles(new StaticFileOptions { @@ -40,7 +39,7 @@ namespace Bit.Server DefaultContentType = "application/octet-stream" }); } - else + else if(configuration.GetValue("webVault") ?? false) { var options = new DefaultFilesOptions(); options.DefaultFileNames.Clear(); @@ -50,7 +49,8 @@ namespace Bit.Server { OnPrepareResponse = ctx => { - if(!ctx.Context.Request.Path.HasValue) + if(!ctx.Context.Request.Path.HasValue || + ctx.Context.Response.Headers.ContainsKey("Cache-Control")) { return; } @@ -68,6 +68,10 @@ namespace Bit.Server } }); } + else + { + app.UseFileServer(); + } } } }