Try to use a tool such as F12 developer tools, Fiddler or Postman to check the Accept-Encoding setting in the request header and the response headers. Perhaps the Content-Encoding and Vary headers aren't present on the response.
To solve this issue, you could try to refer the following steps to set the compression provider:
create a BrotliCompressionProvider class:
public class BrotliCompressionProvider : ICompressionProvider
{
public string EncodingName => "br";
public bool SupportsFlush => true;
public Stream CreateStream(Stream outputStream) => new BrotliStream(outputStream, CompressionMode.Compress);
}
Change the configure service as below:
public void ConfigureServices(IServiceCollection services)
{
services.AddControllersWithViews();
services.AddResponseCompression(options => {
options.Providers.Add<BrotliCompressionProvider>();
options.EnableForHttps = true;
});
services.Configure<BrotliCompressionProviderOptions>(options =>
{
options.Level = CompressionLevel.Fastest;
});
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
//other configs...
app.UseResponseCompression();
app.UseMvc();
}