I have a blazor application where I added text compression, that way:
context.Services.AddResponseCompression(o =>
{
o.EnableForHttps = true;
});
// We use Brotli by default : https://learn.microsoft.com/en-us/aspnet/core/performance/response-compression?view=aspnetcore-3.1
//services.Configure<GzipCompressionProviderOptions>(o => o.Level = System.IO.Compression.CompressionLevel.Optimal);
context.Services.Configure<BrotliCompressionProviderOptions>(options =>
{
options.Level = CompressionLevel.Fastest;
});
and
app.UseResponseCompression();
When I check in my browser, it seems that the compression is activated:
Now, I test the web site speed and the first proposal is to add Text Compression. So, I do not understand why I have such a message:
Does someone have any idea of the problem?
The ASP.NET Core docs outline that using
CompressionLevel.Fastest
will result in the compression completing the fastest, not the webpage loading the fastest.To get the highest level of compression you should use
CompressionLevel.Optimal
.