1818using Microsoft . AspNetCore . Hosting ;
1919using Microsoft . AspNetCore . Http ;
2020using Microsoft . AspNetCore . Mvc ;
21- using Microsoft . AspNetCore . ResponseCompression ;
2221using Microsoft . AspNetCore . Routing ;
2322using Microsoft . AspNetCore . Server . Kestrel . Core ;
2423using Microsoft . AspNetCore . StaticFiles ;
@@ -206,13 +205,14 @@ public void ConfigureServices(IServiceCollection services)
206205 options . Cookie . HttpOnly = true ;
207206 } ) ;
208207
209- services . Configure < GzipCompressionProviderOptions > ( options =>
210- options . Level = System . IO . Compression . CompressionLevel . Fastest ) ;
208+
211209 services . AddDirectoryBrowser ( ) ;
212- services . AddResponseCompression ( options =>
210+ if ( GXUtil . CompressResponse ( ) )
213211 {
214- options . MimeTypes = new [ ]
212+ services . AddResponseCompression ( options =>
215213 {
214+ options . MimeTypes = new [ ]
215+ {
216216 // Default
217217 "text/plain" ,
218218 "text/css" ,
@@ -225,8 +225,10 @@ public void ConfigureServices(IServiceCollection services)
225225 // Custom
226226 "application/json" ,
227227 "application/pdf"
228- } ;
229- } ) ;
228+ } ;
229+ options . EnableForHttps = true ;
230+ } ) ;
231+ }
230232 services . AddMvc ( ) ;
231233 }
232234 public void Configure ( IApplicationBuilder app , IHostingEnvironment env , ILoggerFactory loggerFactory )
@@ -251,8 +253,10 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
251253 provider . Mappings [ ".usdz" ] = "model/vnd.pixar.usd" ;
252254 provider . Mappings [ ".sfb" ] = "model/sfb" ;
253255 provider . Mappings [ ".gltf" ] = "model/gltf+json" ;
254-
255- app . UseResponseCompression ( ) ;
256+ if ( GXUtil . CompressResponse ( ) )
257+ {
258+ app . UseResponseCompression ( ) ;
259+ }
256260 app . UseCookiePolicy ( ) ;
257261 app . UseSession ( ) ;
258262 app . UseStaticFiles ( ) ;
0 commit comments