Skip to content

Commit 282670d

Browse files
author
Benjamin Stern
authored
Update README.md (#202)
Added edge case considerations for when including response compression as included in the feature #147, to allow for the end user to understand how to make sure that it compresses the responses and function correctly when utilized with this library.
1 parent 2e67222 commit 282670d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,16 @@ This version string changes every time one or more of the source files are modif
212212

213213
This technique is called *cache busting* and is a critical component to achieving high performance, since we cannot utilize browser caching of the CSS and JavaScript files without it. That is also why it can not be disabled when using WebOptimizer.
214214

215+
#### HTTPS Compression Considerations
216+
When utilizes with the [`services.AddResponseCompression`](https://docs.microsoft.com/en-us/aspnet/core/performance/response-compression?view=aspnetcore-6.0) middleware included in the [Feature](https://github.com/ligershark/WebOptimizer/pull/147), it's important to note that by default the *cache busted* assets may not be included as the *Response Header: content-type* is modified from the default **application/javascript** to **text/javascript**, which is not currently a supported default [ResponseCompressionDefaults.MimeTypes](https://github.com/aspnet/BasicMiddleware/blob/master/src/Microsoft.AspNetCore.ResponseCompression/ResponseCompressionDefaults.cs) and can be added in the *Startup.ConfigureServices* like so:
217+
```csharp
218+
services.AddResponseCompression( options => {
219+
options.MimeTypes = ResponseCompressionDefaults.MimeTypes.Concat(
220+
new[] { "text/javascript"}
221+
);
222+
});
223+
```
224+
*Note: `app.UseResponseCompression()` should be used prior to `app.UseWebOptimizer()`*
215225
### Inlining content
216226
We can also use Web Optimizer to inline the content of the files directly into the Razor page. This is useful for creating high-performance websites that inlines the above-the-fold CSS and lazy loads the rest later.
217227

0 commit comments

Comments
 (0)