Skip to main content

ASP.NET Core Gzip Response Compression

Compress your HTML and static files

There's a package available for providing compression middleware.

"Microsoft.AspNetCore.ResponseCompression" : "1.0.0"

Add the the services

public void ConfigureServices(IServiceCollection services)
    // Response Compression
    services.Configure<GzipCompressionProviderOptions>(options => options.Level = CompressionLevel.Fastest);
    services.AddResponseCompression(options =>
        // Enable HTTPS if required
        options.EnableForHttps = true; 

        // Add extra mime types to the defaults
        options.MimeTypes = ResponseCompressionDefaults.MimeTypes.Concat(new[]


Configure the pipeline

public void Configure(IApplicationBuilder app)
    // Response Compression

    // MVC and static files come after

Hello, my name is Lee and I work as a full-stack web developer specialising in Microsoft ASP.NET technologies. I love using Umbraco and also MANAGED, my own application management software.

Contact me at

All skills


Get in touch to talk about your project or just ask me a question.