Bringing More Power To Edge Rules! Introducing Variable Expansion

Posted by:

bunny.net Edge Rules allow a simple, but powerful way of controlling the CDN based on specific conditions on the edge of our network. Using Edge Rules, among other things allows you to dynamically set headers, redirect the user or change the origin URL.

All of these operations can be highly dynamic, but up until now, we only exposed a simple set of variables (hostname, country_code, path, query_string, request_method, file_name). While this covers many of the use-cases and allows some of our users to do powerful logic when selecting origin servers, it's still fairly limited.

Today, we're excited to announce that we're bringing even more power to our Edge Rule system with the new variable expansion system.

More Information From The Edge

The new variable expansion system allows you to access a whole new set of information on the edge and apply those to the Edge Rule variables, including specific header values, query string values and detailed request parameters. This can be done through a simple new syntax such as %{User.IP}.

The following variables are now possible:

  • Request headers by name
  • Query parameters by name
  • Request method
  • Request path
  • Full request query string
  • File name
  • Path
  • Directory
  • Extension
  • Hostname
  • User IP
  • Country code
  • Server ID
  • Server Zone Code

Additionally, we've made adding new variables extremely easy and we're continuing to explore what other information might be useful. To learn how to use Variable Expansion with a detailed explanation, you can visit the documentation page.

Helping Make The Internet Hop Faster

It's our goal to make complex global problems simple and help make the internet hop faster. The new system opens a set of new possibilities for everyone working on complex global systems and we're thrilled to be able to make this as simple as possible.

If we're missing any variables that you'd love to use, please make sure to let us know and we'll be delighted to help out.