1
0
mirror of https://github.com/bitwarden/server.git synced 2025-02-01 23:31:41 +01:00

special config for webVault

This commit is contained in:
Kyle Spearrin 2018-08-07 15:04:11 -04:00
parent 68bd755dc5
commit 5e0668077f

View File

@ -31,8 +31,7 @@ namespace Bit.Server
.AddConsole() .AddConsole()
.AddDebug(); .AddDebug();
var serveUnknown = configuration.GetValue<bool?>("serveUnknown") ?? false; if(configuration.GetValue<bool?>("serveUnknown") ?? false)
if(serveUnknown)
{ {
app.UseStaticFiles(new StaticFileOptions app.UseStaticFiles(new StaticFileOptions
{ {
@ -40,7 +39,7 @@ namespace Bit.Server
DefaultContentType = "application/octet-stream" DefaultContentType = "application/octet-stream"
}); });
} }
else else if(configuration.GetValue<bool?>("webVault") ?? false)
{ {
var options = new DefaultFilesOptions(); var options = new DefaultFilesOptions();
options.DefaultFileNames.Clear(); options.DefaultFileNames.Clear();
@ -50,7 +49,8 @@ namespace Bit.Server
{ {
OnPrepareResponse = ctx => OnPrepareResponse = ctx =>
{ {
if(!ctx.Context.Request.Path.HasValue) if(!ctx.Context.Request.Path.HasValue ||
ctx.Context.Response.Headers.ContainsKey("Cache-Control"))
{ {
return; return;
} }
@ -68,6 +68,10 @@ namespace Bit.Server
} }
}); });
} }
else
{
app.UseFileServer();
}
} }
} }
} }