IndexConfigurationVirtual servers

Virtual Server: Rules

Besides the connection handler set for the rule, there are other parameters that can be set in order to customize the rule behavior. This menu offers the following tabs:

  1. Rule: this is the rule type.

  2. Handler: Specifies which handler should manage the requests that match the rule.

  3. Encoding: to manage the compression of the contents to be sent.

  4. Time: to manage the configuration of HTTP Cache headers used to identify cacheable content.

  5. Security: in this section one can configure Access Restrictions and Authentication.

  6. Traffic Shaping: Sets an outbound traffic limit for this rule, specified in bytes per second.

Rule

Several rule types are available to fit the needs of specific tasks. Sometimes you will want to restrict the content delivery based on a user’s country of origin, sometimes you might want a behavior to be applied to a web directory, or you might be interested in modeling how the web server behaves if a request matches an existing file (or not).

There is a complete list of the types in the Rule Types section.

The behavior can be specified further by combining several basic rule-types into a complex rule. Complex rules can be defined by combining several basic types with the boolean operators AND, OR and NOT. For instance, we could define a rule that would apply to certain directories only if the request was made from a specific country. It would be as simple as defining a directory type rule AND a GeoIP type rule.

Handler

This allows to fine tune the behavior of any of the available handlers. Since so many options are available, refer to the complete list of handlers shipped with Cherokee.

Handlers are the modules that generate the information with which the server responds to a client’s request. By default Cherokee provides a number of them:

Encoding

The content sent by Cherokee can be encoded or not. This tab is used to configure, on a per-rule basis, what encoders, if any, are to be applied.

You can set up the encoding method to use, and it shall be applied to whatever content is handled by the parent rule.

Whenever you set up a virtual server, creating a rule where gzip is enabled by default for the following file types: html, htm, txt, css and js is a good idea. You are encouraged to use this. Hardware is cheap. Bandwidth is not.

Time

This tab specifies the connection timeout and content expiration settings.

HTTP/1.1 defines caching methods in HTTP. Cherokee-Admin can automatically adjust the Cache-Control and Expire headers depending on the values you have configured. The available options are:

  1. Not set: Does not write the caching headers.

  2. 1970: Corresponds to the Unix Epoch.

  3. 2038: Maximum date value representable in POSIX time.

  4. Custom Value: set a value by hand.

Security

This section will give access to access restriction settings and authentication settings.

Logging

Here we can specify whether or not the requests that match this rule should be logged. This can be useful in order to tidy up our log files, since some rule matches might not provide any relevant logging information

Access Restrictions

Examples

Authentication

This parameter allows to configure user/password protected entries. A validator has to be used in each Auth entry in order to specify the validation mechanism. The following validators are available:

It is important to take into consideration that there are two different authentication mechanisms:

Some validators can only handle one of those mechanisms because of technical limitations. In case the module supports both of them, the interface allows to choose whether one or both are to be used.

Traffic Shaping

In order to limit the amount of traffic used for a specific rule you can set up a traffic shaper. By default no traffic shaping will occur, all possible network resources are used to facilitate the clients.

This parameter will not act globally, but per outgoing connection. Hence, 20 clients limited to 1kB/s will give 20kB/s as total outbound traffic. To limit the amount of traffic a value in Bytes per second should be entered.