Created
July 16, 2020 02:57
-
-
Save NDiiong/32aa9b24bad1d61eb504dc500c6abf22 to your computer and use it in GitHub Desktop.
Response Compression .Net Core
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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