# Fastly Compute@Edge integration

All [Fastly](https://www.fastly.com/) customers can benefit of redirection.io by using [Compute@Edge](https://www.fastly.com/products/edge-compute/serverless), the serverless edge computing solution provided by Fastly.

Using redirection.io with Fastly is pretty straightforward:

1. [create a redirection.io account](/content/manager/register/index.html);
2. [create a redirection.io organization and a project](/content/documentation/user-documentation/what-are-organizations-and-projects/index.html). At this step, you may want to [invite your co-workers](/content/documentation/user-documentation/invite-new-collaborators/index.html) ;
3. head to the "instances" screen of your project, and hit the "Setup on your infrastructure" button
4. This opens a lateral panel containing your "project key". Copy this key and install the redirection.io Fastly worker ( [see below](/content/documentation/developer-documentation/fastly-compute-edge-integration#manually-deploying-the-fastly-compute-edge-worker/index.html))
5. You're all set :-)

## Manually deploying the Fastly Compute@edge worker [Permalink to this section](/content/documentation/developer-documentation/fastly-compute-edge-integration#manually-deploying-the-fastly-compute-edge-worker "Permalink to this section"/index.html)

Our Fastly Compute@edge worker code and tooling is open source and [available on redirection.io's Github account](https://github.com/redirectionio/fastly-worker).

Here are the required steps to deploy the redirection.io worker to your Fastly account:

1. [install the Rust toolchain](https://www.rust-lang.org/tools/install) in your development environment, eg.:

```bash
   apt install autoconf build-essential curl wget unzip
   curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable -y
   ```

2. install [fastly](https://github.com/fastly/cli), the official CLI for interacting with the Fastly platform, and [configure the Fastly cli](https://developer.fastly.com/reference/cli/#configuring):

```bash
   fastly configure
   ```

3. clone the code of the library (you may fork it to your own account, if you need to do some changes to the worker code):

```bash
   git clone https://github.com/redirectionio/fastly-worker
   cd fastly-worker
   ```

4. copy the file `fastly.dist.toml` to `fastly.toml`. If you wish to use the Fastly local server, edit the values:

- line 11, `backend_name`: set the URL / IP Address of the backend to proxify the traffic

5. in your Fastly dashboard, create a dictionary named `redirectionio`, and configure the following keys:

- `backend_name`:
     - This directive is **required**
     - Description: the name of the backend to proxify the traffic to. Use the `name` that you configured for your backend server in the "Origins > Hosts" menu of your Fastly service
   - `token`:
     - This directive is **required**
     - Description: this redirection.io project key, as retrieved above
   - `instance_name`:
     - This directive is **required**
     - Description: type here a name for this Fastly instance, as it should be displayed in the redirection.io manager "instances" screen
   - `add_rule_ids_header`:
     - This directive is **optional**
     - Default: **false**
     - Description: set this to `true` to append a response Header `X-RedirectionIo-RuleIds` containing the executed redirection.io rules identifier, separated by a `;`
   - `log_endpoint`:
     - This directive is **optional**
     - Description: if you wish to log the output of the worker to a custom Fastly logging endpoint (as defined under the "Logging" menu), use for `log_endpoint` the name of the logging endpoint to use (for example, `my_logs`). Please note that whether this dictionary key is defined or not, error logs will still be collected as regular Fastly logs.
   - `log_level`:
     - This directive is **optional**
     - Description: if the directive `log_endpoint` above is defined, this key allows to configure the log level.
     - Possible values: `OFF` or `ERROR` or `WARN` or `INFO` or `DEBUG` or `TRACE`

6.  in your Fastly dashboard, add a new "Origin Host" to your service. This host must be named `redirectionio` and have the address "agent.redirection.io".
7. publish the worker to your Fastly service project:

```bash
   fastly compute publish --service-id=XXXXXXXX
   ```

Your newly created worker should work after a couple of seconds!

### Debugging locally using the local Fastly server [Permalink to this section](/content/documentation/developer-documentation/fastly-compute-edge-integration#debugging-locally-using-the-local-fastly-server "Permalink to this section"/index.html)

The Fastly cli proposes a local server, which is useful to run a worker locally before pushing it online.

To use this local server, copy the file `redirectionio.dist.json` to `redirectionio.json`, and edit the values:

- `backend_name`: the name of the fastly backend to proxify the traffic to (it should be "`backend_host`", or change this name in `fastly.toml` too)
- `token`: this redirection.io project key, as retrieved above
- `instance_name`: type here a name for this Fastly instance, as it should be displayed in the redirection.io manager "instances" screen
- `add_rule_ids_header`: Set this to "true" to append a response Header `X-RedirectionIo-RuleIds` containing the executed redirection.io rules identifier, separated by a `;`

Then, launch the local web server:

```sh
fastly compute serve
```

This page has been updated on Apr 16, 2026.
