Skip to content

Instantly share code, notes, and snippets.

@NDiiong
Created July 16, 2020 02:57
Show Gist options
  • Save NDiiong/32aa9b24bad1d61eb504dc500c6abf22 to your computer and use it in GitHub Desktop.
Save NDiiong/32aa9b24bad1d61eb504dc500c6abf22 to your computer and use it in GitHub Desktop.
Response Compression .Net Core
public void ConfigureServices(IServiceCollection services)
{
services.AddResponseCompression(options =>
{
options.EnableForHttps = true;
options.Providers.Add<BrotliCompressionProvider>();
});
services.Configure<BrotliCompressionProviderOptions>(options => options.Level = CompressionLevel.Optimal);
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseResponseCompression();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment