# Upsun integration

This page explains how to setup and configure redirection.io on Upsun (formerly platform.sh) or Symfony Cloud hosting environments, in order to let your SEO or marketing team check the HTTP traffic and fix SEO issues in an easy and flexible way.

## What is Upsun? What is Symfony Cloud?
[Upsun](https://upsun.com/) is a PaaS: it provides a fully managed hosting environment, built to ease up the setup of a scalable and maintained hosting platform. The goal of such hosting providers is to provide an efficient way to build feature-full Web platform, without the need for a complex infrastructure design or repetitive ops or sysadmin operations.

Shortly said, [Symfony Cloud](https://symfony.com/cloud/) is a commercial offer tailored for [the Symfony framework](https://symfony.com/), and built on the technical platform of Upsun (formerly platform.sh).

Some legal stuff: while we believe that both Upsun and Symfony Cloud do a great job, this guide does not imply that we endorse or advise their services. They own their trademarks, we are not affiliated, etc. etc.

In the rest of this guide, we will provide instructions for Upsun (Flex). If you deploy your project on Upsun Fixed (formerly platform.sh), the principles are the same, only a few terms change. You can read the [migration guide on Upsun website](https://developer.upsun.com/tutorials/migration/from-fixed).

## Install layout

Upsun proposes [many services out of the box](https://developer.upsun.com/docs/add-services#type) (Elasticsearch, Memcached, Varnish, etc.) that can be enabled in a hosted project with only a few lines of YAML. Unfortunately, Upsun does not (yet) provide a native redirection.io integration (which would be useful, isn't it?), but it is possible to get it running in a performant way with few configuration.

A schema is worth thousand words, so here is a standard Upsun application layout:

And here is the layout that is going to be used with the redirection.io agent installed:

In this setup, the incoming HTTP(s) requests are routed to the redirection.io agent in reverse-proxy mode, then passed to the applicative backend. The `redirectionio-agent` http(s) reverse-proxy is very performant and does not have a significative nor noticeable impact on overall performance, which makes it an ideal solution to fix SEO issues on the fly, at the edge of your infrastructure.

If you are busy and want to test our solution right away, please click this button to use a pre-defined project template:

This will create a base Upsun project with redirection.io installed:

### Setup your application

First, setup your application with Upsun as you would do without using redirection.io. So, for an application named `app`, here is the traditional architecture:

```markdown
├─ .upsun
   ├─ config.yaml    # defines the routes and the services required by the application
└─ app/              # contains your application code
   └─ index.html
```

The `.upsun/config.yaml` file defines [how to route the traffic within the Upsun app](https://developer.upsun.com/docs/routes). Usually, you will want to send all the traffic to your application:

```yaml
routes:
    "https://{default}/":
        type: upstream
        upstream: "example-app:http"

"https://www.{default}/":
        type: redirect
        to: "https://{default}/"
```

In the `.upsun/config.yaml` file, you can also [configure the Upsun application](https://developer.upsun.com/docs/configure-apps/index) (name, disk size, type of application, etc.). For example:

```yaml
applications:
    example-app:
        type: golang:1.25
        web:
            locations:
                "/":
                    root: "app"
                    passthru: "/index.html"
```

### Setup the redirectionio-agent

As the redirectionio-agent is a simple binary with no external dependency (no database, etc. is required), you just have to install the agent binary as an Upsun application, as explained in the [Multiple applications](https://developer.upsun.com/docs/configure-apps/multi-app/index) documentation guide.

First, create the configuration for the redirection.io agent:

```markdown
└─ redirectionio
   └─ agent.yaml          # the redirectionio-agent configuration
```

In `redirectionio/agent.yaml`, define the [`redirectionio-agent` configuration directives](/content/documentation/agent-documentation/agent-configuration-reference#reverse-proxy/index.html) as explained in our documentation:

```yaml
# /redirectionio/agent.yaml
instance:
    name: "${PLATFORM_ENVIRONMENT}"

# Directory where the rules will be persisted
    persist: "${PLATFORM_APP_DIR}/rules"

logging: true

# Run the agent as a reverse proxy
reverse_proxy:
    listen:
        - "tcp://0.0.0.0:${PORT}" # Listen endpoint
    forward:
        address: "app.internal" # Remote endpoint
    agent:
       project_key: "${REDIRECTIONIO_KEY}" # Project key to use

# Optional agent technical logs
# log:
#     -
#         output: file
#         format: text
#         path: "${PLATFORM_APP_DIR}/log/agent.log"
```

Of course, you can adapt the `instance_name` (here, it is generated based on [the `PLATFORM_ENVIRONMENT` environment variable](https://developer.upsun.com/docs/development/variables/use-variables#use-provided-variables)).

All the [agent proxies configuration directives](/content/documentation/developer-documentation/agent-configuration-reference#reverse-proxy/index.html) can be used in the `reverse_proxy:` section.

Edit `.upsun/config.yaml`, to add the redirectionio-agent application configuration:

```yaml
applications:
    redirectionio-agent:
        type: golang:1.15
        disk: 128
        hooks:
            build: |
                set -ex
                curl -s -J -L "https://packages.redirection.io/dist/stable/3/any/redirectionio-agent-latest_any_amd64.tar.gz" | tar -C /app/ -xzpf -
        relationships:
            app: "example-app:http"
        web:
            upstream:
                socket_family: tcp
                protocol: http
            commands:
                start: |
                    set -ex
                    /app/redirection-agent/redirectionio-agent --config ./agent.yaml
            locations:
                "/":
                    allow: false
                    passthru: true

mounts:
            # rules will be saved locally in this folder
            'rules':
                source: local
                source_path: rules
            # redirection.io log folder
            'log':
                source: local
                source_path: log

# Your original application configuration
    example-app:
        type: golang:1.25
        web:
            locations:
                "/":
                    root: "app"
                    passthru: "/index.html"
```

There's not much to explain about this application:

- the `disk` directive defines the size of the attached disk. Depending on your ruleset size, and your redirection.io [agent configuration about data persistence](/content/documentation/developer-documentation/agent-configuration-reference#persist/index.html), you may want to increase this value;
- the `type` of the image used is `golang`, but you can use [any of the available types](https://developer.upsun.com/docs/configure-apps/app-reference/single-runtime-image#type). It happens that the golang image is the smallest one;
- the `hooks.build` node downloads the latest release of the redirection.io agent at build time;
- the `relationships.app` node allows to "link" both Upsun applications. Changing this name requires to also change the `reverse_proxy.forward.address` node in the `agent.yaml` file;
- the `web.command.start` node defines how to start the `redirectionio-agent` binary with the right configuration;
- the `mounts` section defines paths that must be made writable to the redirection.io agent

The hook above downloads and installs the last available version of the redirection.io agent software. If you wish to run a fixed version, you can of course replace the download URL - simply use [one of the packages available in our repository](https://packages.redirection.io/dist/stable/3/any/).

Once you have found the redirection.io project key ( [in the "instances" screen of the manager](/content/manager/index.html), click on the "Setup on your infrastructure" button), add this key as [an Upsun project variable](https://developer.upsun.com/docs/development/variables/set-variables#create-project-variables), which will help keep this key secret (and shared across your team):

```bash
$ upsun variable:create --name env:REDIRECTIONIO_KEY --sensitive true --value "set your key here"
```

Last step, change the `.upsun/config.yaml` file to instruct Upsun to route the incoming traffic to the newly created `redirectionio-agent` application instead of the `app` application:

```yaml
routes:
    "https://{default}/":
        type: upstream
        upstream: "redirectionio-agent:http"

"https://www.{default}/":
        type: redirect
        to: "https://{default}/"
```

## Benefits

Once the changes have been made, commit and push to the `upsun` remote. This will trigger a new deploy of your project:

```bash
$ git commit -m "let's use redirection.io"
$ git push

(things happen)

Processing activity: John Doe pushed to Master
    Found 1 new commit

Building application 'example-app' (runtime type: golang:1.25, tree: e7f1eab)
      Generating runtime configuration.
      Executing pre-flight checks...
      Compressing application.
      Beaming package to its final destination.

Building application 'redirectionio-agent' (runtime type: golang:1.25, tree: 2fd5612)
      Generating runtime configuration.
      Executing build hook...
        W: + curl -s -J -L https://packages.redirection.io/dist/stable/3/any/redirectionio-agent-latest_any_amd64.tar.gz
        W: + tar -C /app/ -xzpf -
      Executing pre-flight checks...
      Compressing application.
      Beaming package to its final destination.

Redeploying environment master
      Preparing deployment
      Closing services example-app, router, and redirectionio-agent
      Opening application example-app and its relationships
      Opening environment
      Environment configuration
        example-app (type: golang:1.25, size: S, disk: 128)
        redirectionio-agent (type: golang:1.25, size: S, disk: 128)

Environment routes
        http://master-XXXXXXXXXX.platformsh.site/ redirects to https://master-XXXXXXXXXX.platformsh.site/
        http://www.master-XXXXXXXXXX.platformsh.site/ redirects to https://www.master-XXXXXXXXXX.platformsh.site/
        https://master-XXXXXXXXXX.platformsh.site/ is served by application `redirectionio-agent`
        https://www.master-XXXXXXXXXX.platformsh.site/ redirects to https://master-XXXXXXXXXX.platformsh.site/
```

Send a HTTP(s) request to your application URL, and you should see some traffic logged [in the redirection.io manager](/content/manager/index.html). You can now [audit your traffic](/content/features/logs/index.html), [create redirects](/content/features/redirections/index.html) and fix SEO errors with ease!

Next step, [learn how to create your first redirections](/content/documentation/user-documentation/create-a-rule/index.html)!

This page has been updated on Apr 14, 2026.
