aspnet / BasicMiddleware

[Archived] Basic middleware components for ASP.NET Core. Project moved to https://github.com/aspnet/AspNetCore
Apache License 2.0
169 stars 84 forks source link

ResponseCompression is ignored under IIS #232

Closed Tratcher closed 6 years ago

Tratcher commented 7 years ago

From @oliverjanik on May 9, 2017 14:4

Reposted from #119:

This is an issue, I just ran into this today. Please reopen. It took me a while to debug.

Here are my observations:

Asp.Net Core gzips css and js bundles without any configuration I've added ResponseCompression to also gzip static SVGs in my project: services.AddResponseCompression(o => { o.MimeTypes = new[] { "image/svg+xml" }; });

When I run this from with VS (IIS Express) I get my SVG's gzipped

When I deploy and this runs under Win 2012 R2 under IIS which has static and dynamic compression OFF nothing is GZipped (not even the bundles)

My conclusion is that IIS acting as a proxy decompresses incoming requests and serves them plain.

Blank rule for dynamic compression ON is NOT an option because of CRIME.

Copied from original issue: aspnet/StaticFiles#194

sergei66666 commented 6 years ago

I had the same problem. If use HTTPS try add EnableForHttps services.AddResponseCompression(o => { o.MimeTypes = new[] { "image/svg+xml" }; o.EnableForHttps = true; });

thanks to https://stackoverflow.com/questions/46832723/net-core-response-compression-middleware-for-static-files

muratg commented 6 years ago

@shirhatti Thoughts on this one?

muratg commented 6 years ago

https://github.com/aspnet/IISIntegration/issues/1523