Skip to content

Commit

Permalink
bump file upload limit to the max
Browse files Browse the repository at this point in the history
  • Loading branch information
Radoslav Radev committed May 16, 2024
1 parent 571e103 commit 61d5e59
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Backend/APIGateway/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Server.Kestrel.Core;
using Ocelot.DependencyInjection;
using Ocelot.Middleware;
using Ocelot.Provider.Consul;
Expand All @@ -24,6 +26,17 @@
builder.Services.AddSwaggerGen();
builder.Services.AddCors();

builder.Services.Configure<KestrelServerOptions>(options =>
{
options.Limits.MaxRequestBodySize = null; // Remove file upload limit of 30mb the limit
});

builder.Services.Configure<FormOptions>(options =>
{
options.ValueLengthLimit = int.MaxValue;
options.MultipartBodyLengthLimit = int.MaxValue;
});

builder.Services.AddOcelot().AddConsul();
builder.Services.AddSwaggerForOcelot(builder.Configuration);

Expand Down
6 changes: 6 additions & 0 deletions Backend/Upload/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using MassTransit;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Server.Kestrel.Core;
using Upload;
using Upload.Services;
Expand Down Expand Up @@ -30,6 +31,11 @@
options.Limits.MaxRequestBodySize = null; // Remove file upload limit of 30mb the limit
});

builder.Services.Configure<FormOptions>(options =>
{
options.ValueLengthLimit = int.MaxValue;
options.MultipartBodyLengthLimit = int.MaxValue;
});

builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
Expand Down

0 comments on commit 61d5e59

Please sign in to comment.