1 of 20
2 of 20
3 of 20
4 of 20
5 of 20
6 of 20
7 of 20
8 of 20
9 of 20
10 of 20
11 of 20
12 of 20
13 of 20
14 of 20
15 of 20
16 of 20
17 of 20
18 of 20
19 of 20
20 of 20

doc

How to enable gzip compression for Edge Application

Gzip is the standard method for lossless file compression for web applications. By using the Deflate algorithm to reduce the size of files before they are sent to browsers, gzip compression ensures faster page rendering and downloads for your users.

See the official gzip website for useful links and information.

When you enable gzip compression for Azion Edge Application, the following events take place during a request for content from your application:

  1. At the edge node, Azion verifies the cache for a compressed version of the file.
  2. If the file’s already compressed, it’s delivered to the browser. If it isn’t, Azion compresses the file, returns it to the browser, and adds it to the cache.
  3. The browser interprets and decompresses the file.

  1. Using Rules Engine to enable gzip compression
  2. Support for gzip compression
    2.1. About MIME types
    2.2. List of supported MIME types for gzip compression

1. Using Rules Engine to enable gzip compression

You can enable gzip compression for any edge application using the Rules Engine for Edge Application.

To enable gzip compression for your application, follow these steps:

  1. Access Real-Time Manager (RTM).
  2. Select Products menu > Edge Application.
  3. Click on the application you want to configure or build a new one.
  4. In the Rules Engine tab, click the Add Rule button and select either Response Phase or Request Phase.
  5. In the Criteria section, define the desired criteria for activation of the behavior.

    To apply gzip compression for your entire application, you can set a default criteria as follows:

    If ${uri} starts with /

  6. In the Behavior section, select the Enable gzip behavior.
  7. Click the Save button.

To verify whether gzip compression has been applied, access your application and inspect the page. The Content-Encoding request header should contain the value gzip.


2. Support for gzip compression

Azion servers support gzip compression for some file extensions, which are identified via their MIME (Multipurpose Internet Mail Extensions) type.

2.1. About MIME types

Whenever a page loads within a web browser, a web server sends information regarding the contents and data of the page to the browser. Such details are stored in request headers and they are passed to the browser so that it can load and interpret the page.

The Content-Type header is responsible for processing page contents through the MIME type. MIME types inform the types of documents, files, or byte arrays within the web application, as well as how they should be processed.

MIME types consist of a type and subtype combined by a / symbol in between each other. The type represents the category of that data file; for instance, text or image. The subtype stands for the exact data type represented by the MIME type. For instance, the MIME type image could carry a subtype jpeg or png.

Therefore, when your browser runs into an <img> HTML tag, it sends out a request to the server. If this image is a .png, the server will return the header and MIME type: Content-Type: image/png.

The entity responsible for all official MIME types is the Internet Assigned Numbers Authority (IANA).

Files that have undergone gzip compression should retain their original MIME type on the request header, since the browser is responsible for decompressing the file upon the end of the request.

2.2. List of supported MIME types for gzip compression

MIME Type Extension Document type
application/eot .eot MS Embedded OpenType fonts
application/font   OpenType font
application/font-sfnt .ttf
.otf
SFNT format
application/font-woff .woff Web Open Font Format (WOFF)
application/font-woff2 .woff2 Web Open Font Format 2 (WOFF2)
application/javascript .js JavaScript
application/json .json JSON format
application/ld+json .jsonld JSON-LD format
application/opentype .otf
.otc
.ttf
.ttc
OpenType
application/otf .otf OpenType
application/truetype .ttf
.tte
TrueType
application/ttf .ttf TrueType
application/vnd.ms-fontobject .eot MS Embedded OpenType fonts
application/x-font-opentype .otf OpenType
application/x-font-truetype .ttf TrueType
application/x-font-ttf .ttc
.ttf
TrueType
application/x-httpd-cgi .pl
.sh
.cgi
CGI scripts/programs
application/x-javascript .js JavaScript
application/x-mpegurl .M3U8 iPhone Index
application/x-opentype .ttc OpenType font
application/x-otf .otf OpenType font
application/x-perl .plx
.pl
.pm
.xs
.t
.pod
Perl script
application/x-ttf .ttf TrueType
application/xhtml+xml .xhtml XHTML
application/xml+rss .rss
.xml
RSS, Atom and XML
font/eot .eot Embedded Open Type
font/opentype otf
.otc
.ttf
.ttc
OpenType font
font/otf .otf OpenType font
font/ttf .ttf TrueType font
image/svg+xml .svg Scalable Vector Graphics (SVG)
image/x-icon .ico ICO
text/css .css Cascading Style Sheets (CSS)
text/csv .csv Comma-separated values (CSV)
text/html .htm
.html
HyperText Markup Language (HTML)
text/javascript .js JavaScript
text/js .js JavaScript
text/plain .txt Text (generally ASCII or ISO 8859-n)
text/richtext .rtf Rich Text Format
text/tab-separated-values .tsv
.tab
Tab-separated values
text/x-component .htc HTML Components
text/x-java-source .jav Java Source
text/x-markdown .md Markdown
text/x-script .hlb HP OpenVMS
text/xml
application/xml
.xml XML

Didn’t find what you were looking for? Open a support ticket.