File tree Expand file tree Collapse file tree 1 file changed +25
-2
lines changed
src/StatCan.OrchardCore.Cms.Web Expand file tree Collapse file tree 1 file changed +25
-2
lines changed Original file line number Diff line number Diff line change 6
6
using StatCan . OrchardCore . Security ;
7
7
using Microsoft . Extensions . Configuration ;
8
8
using Microsoft . AspNetCore . Http ;
9
+ using Microsoft . AspNetCore . ResponseCompression ;
9
10
10
11
namespace web
11
12
{
@@ -29,7 +30,29 @@ public void ConfigureServices(IServiceCollection services)
29
30
services . AddOrchardCms ( ) ;
30
31
services . Configure < IdentityOptions > ( options =>
31
32
{
32
- Configuration . GetSection ( "IdentityOptions" ) . Bind ( options ) ;
33
+ Configuration . GetSection ( "IdentityOptions" ) . Bind ( options ) ;
34
+ } ) ;
35
+ services . Configure < GzipCompressionProviderOptions > ( options => options . Level = System . IO . Compression . CompressionLevel . Optimal ) ;
36
+ services . AddResponseCompression ( options =>
37
+ {
38
+ options . MimeTypes = new [ ]
39
+ {
40
+ // General
41
+ "text/plain" ,
42
+ // Static files
43
+ "text/css" ,
44
+ "application/javascript" ,
45
+ // MVC
46
+ "text/html" ,
47
+ "application/xml" ,
48
+ "text/xml" ,
49
+ "application/json" ,
50
+ "text/json" ,
51
+ // WebAssembly
52
+ "application/wasm" ,
53
+ // Custom
54
+ "image/svg+xml"
55
+ } ;
33
56
} ) ;
34
57
}
35
58
@@ -39,7 +62,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
39
62
{
40
63
app . UseDeveloperExceptionPage ( ) ;
41
64
}
42
-
65
+ app . UseResponseCompression ( ) ;
43
66
app . UseStatCanSecurityHeaders ( )
44
67
. UseStaticFiles ( )
45
68
. UseOrchardCore ( builder=> builder
You can’t perform that action at this time.
0 commit comments