🐛 Trying to fix upload offset not found in frontend
This commit is contained in:
@@ -10,33 +10,34 @@ namespace DysonNetwork.Shared.Http;
|
||||
|
||||
public static class KestrelConfiguration
|
||||
{
|
||||
public static WebApplicationBuilder ConfigureAppKestrel(this WebApplicationBuilder builder, IConfiguration configuration)
|
||||
public static WebApplicationBuilder ConfigureAppKestrel(
|
||||
this WebApplicationBuilder builder,
|
||||
IConfiguration configuration,
|
||||
long maxRequestBodySize = 50 * 1024 * 1024
|
||||
)
|
||||
{
|
||||
builder.Host.UseContentRoot(Directory.GetCurrentDirectory());
|
||||
builder.WebHost.ConfigureKestrel(options =>
|
||||
{
|
||||
options.Limits.MaxRequestBodySize = 50 * 1024 * 1024;
|
||||
options.Limits.MaxRequestBodySize = maxRequestBodySize;
|
||||
options.Limits.KeepAliveTimeout = TimeSpan.FromMinutes(2);
|
||||
options.Limits.RequestHeadersTimeout = TimeSpan.FromSeconds(30);
|
||||
|
||||
|
||||
var configuredUrl = Environment.GetEnvironmentVariable("ASPNETCORE_URLS");
|
||||
if (!string.IsNullOrEmpty(configuredUrl)) return;
|
||||
|
||||
|
||||
var certPath = configuration["Service:ClientCert"]!;
|
||||
var keyPath = configuration["Service:ClientKey"]!;
|
||||
|
||||
// Load PEM cert and key manually
|
||||
var certificate = X509Certificate2.CreateFromPemFile(certPath, keyPath);
|
||||
// Now pass the full cert
|
||||
options.ListenAnyIP(5001, listenOptions =>
|
||||
{
|
||||
listenOptions.UseHttps(certificate);
|
||||
});
|
||||
options.ListenAnyIP(5001, listenOptions => { listenOptions.UseHttps(certificate); });
|
||||
|
||||
// Optional: HTTP fallback
|
||||
options.ListenAnyIP(8080);
|
||||
});
|
||||
|
||||
|
||||
return builder;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user