Page Rules - Use Cases

Identifying use cases for page rules are difficult when you first start out with smoxy. This list should give you some ideas what is possible with conditional rules.

Load balancing

In smoxy you can define multiple load balancers pointing to different servers. You can use conditional rules to send the traffic to example.com/blog to a completely different server in a different hosting environment.

A similar set of configuration could be to route API requests to different versions of your API based on the URL path.

Cache Control

Do you have pages that should not be cached? This could be for example a checkout page in an online shop or an edit page of a personal profile.

Setting CORS Header and Access-Control-Allow-Origin

When content from a website is accessed from other domains, it's often necessary to set an Access-Control-Allow-Origin header. This is the case, for example, when JavaScript code provided by the domain https://example-a.com is loaded via XMLHttpRequest from https://example-b.com. The same applies to fonts defined in CSS and loaded from another domain.

With smoxy, a Page Rule can be easily defined to automatically set this header.

Using a regex, for example, \.(woff|woff2|ttf)$, you can define to handle all requests for .woff, .woff2, and .ttf files with the new rule, and with the option HTTP Response Header and the text Access-Control-Allow-Origin=*, access from other websites to these files is finally allowed.

So, no configuration in the application or on the web server is necessary and can be set up easily with just a few clicks.

Last updated

Was this helpful?