Flesk.Net Accelerator is a component for ASP.NET applications that enables standard HTTP response compression in web applications.
The main benefit of HTTP compression is gauged by a smaller content payload, hence less bandwidth used, at the expense of an additional processing in the server.
Typical configurations allow compression ratios of about 50% in average, for text-based content.
This technology is described as part of the HTTP/1.1 protocol,
and it is implemented in the most popular browsers.
The component works by installing an IHttpModule
in a web application of your choice, and configuring the necessary parameters.
To install this component, unzip the downloaded package, and copy the Flesk.Accelerator.dll
file into the /bin directory of a web application.
This component depends on the ICSharpCode.SharpZipLib.dll
assembly, so you should also copy that file.
The HttpModule must be loaded automatically with the app domain, therefore
you must add the following definition to the system.web section of the application's configuration file:
<system.web>
<httpModules>
<add name="CompressionModule" type="Flesk.Accelerator.Module, Flesk.Accelerator" />
</httpModules>
</system.web>
If you choose to install the component in the GAC, then the fully-qualifed type name must be used on all type references.
Configuring Flesk.NET Accelerator is also done in the application's configuration file.
This component defines its own configuration section, thus requiring the following entry:
<configuration>
<configSections>
<sectionGroup name="Flesk.NET">
<section name="HttpCompression" type="Flesk.Accelerator.HttpCompression.ConfigHandler, Flesk.Accelerator" />
</sectionGroup>
</configSections>
...
</configuration>
This allows the inclusion of the custom element where you can change the parameters as needed:
<configuration>
...
<Flesk.NET>
<HttpCompression
Algorithm="Deflate"
CompressionLevel="Normal"
ExcludeContentType="application/x-zip-compressed;image/jpeg;image/png">
<UserAgent Required="false">
<Exclude Match="Google" />
</UserAgent>
<RequestPath>
<Exclude Match="webresource\.axd" />
<Exclude Match="\.asbx" />
<!-- Exclude Microsoft Ajax -->
<Exclude Match="ajax/.+\.ashx" />
</RequestPath>
<ContentType>
<IsText Match="text/.*" />
<IsText Match="application/xml" />
<IsText Match="image/(vnd\.\w+\.)?svg[\-|\+]xml" />
</ContentType>
</HttpCompression>
</Flesk.NET>
...
</configuration>
After completing the configuration steps, you're ready to change the
parametes that best suit your application.
- Algorithm
-
Single choice enumeration with the values: Deflate
or Gzip. Use this parameter to set the preferred
compression algorithm used by the component.
Most clients may accept both deflate and gzip methods, but don't specify the
preferred method. In those cases, Flesk.NET Accelerator will fallback according
to this setting. Otherwise, the method preferred by the client is used.
- CompressionLevel
-
Single choice enumeration with the values: Low,
Normal or High.
Defines the compression level for the Deflate algorithm only.
- ExcludeContentType
-
Defines a semi-colon separated list of content types that should not be compressed.
- UserAgent
-
Defines a list of regular expressions that are matched against the client's header.
If one match is found, then the component will skip processing, and will not compress the response.
If the Required attribute is set to false, the client may send an
empty header, causing the list to be ignored.
- RequestPath
-
Defines a list of regular expressions that are matched against the request URL string.
If one match is found, then the component will skip processing, and will not compress the response.
- ContentType
-
Defines a list of regular expressions that are matched against the header of the server response.
Only the content types defined in this list will be processed for compression.
This list will override the ExcludeContentType setting.