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()
.AddDebug();
var serveUnknown = configuration.GetValue<bool?>("serveUnknown") ?? false;
if(serveUnknown)
if(configuration.GetValue<bool?>("serveUnknown") ?? false)
{
app.UseStaticFiles(new StaticFileOptions
{
@ -40,7 +39,7 @@ namespace Bit.Server
DefaultContentType = "application/octet-stream"
});
}
else
else if(configuration.GetValue<bool?>("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();
}
}
}
}