Conditional Rules

Conditional rules are an incredibly helpful tool to change the behavior of smoxy for specific pages using various conditions of your website and can be as simple or as complex as you like.

Behavior

Conditional Rules are executed for every single request sent to smoxy and are evaluated from top to bottom. If a conditional rule matches the request, it changes the behavior in smoxy according to the configuration and then moves on to the next conditional rule that meets the rule's criteria.

Adding a new conditional rule

Name the Page Rule

When creating a page rule, the name and description can be specified.

Stop

The stop option makes it possible to stop the evaluation of the conditional rules after this rule has been executed. This can be useful to prevent changing the same smoxy configuration multiple times in different rules. No further conditional rules will then be applied.

Define WHEN the rule should apply

Using the provided query builder, you have a tool that will assist you in creating conditions for your new rule.

You can read from a variety of fields that are send with each request to smoxy and compare them to pre-defined values.

Fields:

  • Uri: For example, the URI of this address example.com/category becomes /category.

  • Cookie: Cookie to be checked.

  • Arg: Argument or GET parameter to be checked.

  • IP: The IP from which the request comes.

  • Method: HTTP defines a series of request methods to specify desired actions. You can identify the method used in your rule using this field. (GET, POST, PUT, PURGE, etc.)

  • Host: The HTTP host represents the domain name of the server. You can use it to change smoxy behavior for different hosts. For an example of using the host field, see Best Practices Service Site.

  • User Agent: Which user agent was used for the request.

  • Referer: The Referer header makes it possible to identify referring pages.

  • Accept Language: The Accept Language header specifies the language the client prefers.

  • Cache-Control: The Cache-Control field contains directives (instructions) - in both requests and responses - that control caching in browsers.

  • HTTP: Header to be checked.

  • Country: Indicates which country the request comes from, using the ISO 3166-2 standard.

  • City: Indicates which city the request comes from.

  • Subdivisions: State of the request.

  • Is European: This value is true if the request comes from the EU. Otherwise this value is false.

Operators:

Reading these values is not enough however. In all cases you need to compare the fields with pre-defined values. For this you need operators and smoxy will offer you these for your expressions:

  • Equal: Is the value equal to your provided value.

  • Not Equal: Is the value not equal to your provided textvalue

  • In: The value is in a list of provided values.

  • Not In: The value is in a list of provided values.

  • Matches: You can use a regular expression for the detected value.

  • Exists: Checks if a condition is set. The value is not evaluated in this case.

  • Not exists: Checks if a condition is not set.

  • Contains: The field contains your provided value.

  • Not contains: The field does not contain your provided value.

And / OR:

In addition to all of the operators listed, you can also use and / or operators to make your expression more specific to your use cases.

Pick the settings applied with the rule

This is where you can take full control over your smoxy settings. Every configuration can be overwritten here. The only limitation is your imagination.

  • Do you need higher quality of images for a specific page? You could increase the JPEG, PNG and WebP Quality.

  • Don't want cache on a specific page? Disable the optimization.

  • Do you have an URI that is called /blog and smoxy should send the traffic to a completely different server? Change the load balancer group.

Available settings are grouped. If you want to know what a specific setting implies, check the Configuration Pages like Image Cache, HTML Cache, SSL or Loadbalancer.

Publishing and enabling page rules

When you save a new page rule, you have the option to activate it immediately. An inactive page rule can be activated on the overview page. If you encounter unexpected problems after creating a new Page Rule, you don't need to delete the rule immediately. Simply disable the Page Rule and check your configuration again.

Last updated