//public void ConfigureServices(IServiceCollection services)
services.AddResponseCompression(options =>
{
options.MimeTypes = new[] { "application/json" };
//options.EnableForHttps = true;
});
// ...
// public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IServiceScopeFactory scopeFactory)
app.UseResponseCompression();
Beware of the security issues when using EnableForHttps .