Merge branch 'Feature/program-manager/chat'
# Conflicts: # .gitignore # ServiceHost/appsettings.Development.json # ServiceHost/appsettings.json
This commit is contained in:
@@ -486,6 +486,24 @@ app.UseHttpsRedirection();
|
||||
|
||||
app.UseStaticFiles();
|
||||
|
||||
// Static files برای فایلهای آپلود شده
|
||||
var uploadsPath = builder.Configuration["FileStorage:LocalPath"] ?? Path.Combine(Directory.GetCurrentDirectory(), "Storage");
|
||||
if (!Directory.Exists(uploadsPath))
|
||||
{
|
||||
Directory.CreateDirectory(uploadsPath);
|
||||
}
|
||||
|
||||
app.UseStaticFiles(new StaticFileOptions
|
||||
{
|
||||
FileProvider = new Microsoft.Extensions.FileProviders.PhysicalFileProvider(uploadsPath),
|
||||
RequestPath = "/storage",
|
||||
OnPrepareResponse = ctx =>
|
||||
{
|
||||
// Cache برای فایلها (30 روز)
|
||||
ctx.Context.Response.Headers.Append("Cache-Control", "public,max-age=2592000");
|
||||
}
|
||||
});
|
||||
|
||||
app.UseCookiePolicy();
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user