> ## Documentation Index
> Fetch the complete documentation index at: https://usefoil.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Manage an integration

> Change the domains a Foil first-party integration serves, rotate credentials, update the edge adapter, redeploy or roll back the SDK, and drain and remove an integration.

This page covers the changes you make to a first-party integration after you set it up. They live in the **Manage** area below the checklist on the integration page, in this order: **Domains**, **Proxy credential**, **Cloudflare token**, **Probe zone**, **Edge adapter**, **Advanced**, and **Remove**. Only owners and admins can make these changes, and the dashboard asks you to verify your identity before each one.

## Rename an integration

Select the pencil icon next to the integration's name. A name appears only in the dashboard, so renaming changes nothing on your CDN, and you can rename an integration while an operation is running.

## Change the domains an integration serves

**Domains** turns **Serve every domain routed to this integration** on or off. It isn't shown while an integration is draining, and you can't change the setting while another operation is running. See [Serve several domains](https://usefoil.com/docs/first-party/multiple-domains.md) for what each setting covers.

What happens after a change depends on the deployment:

| Deployment | After a change |
| - | - |
| Not installed yet | The setting applies when you install the integration or start accepting traffic. |
| Cloudflare, deployed by Foil | Foil redeploys. The Worker route moves between `<hostname>/<path>/*` and `*<zone>/<path>/*`. Turning the setting off stops other hostnames in the zone from reaching Foil. |
| Cloudflare, your Worker | Foil deploys nothing. Copy the updated Worker module from step 2 of the integration page and deploy your Worker. |
| AWS CloudFront, deployed by Foil | Foil redeploys the distribution. Turning the setting off makes requests on other alternate domain names use the site origin as the `Origin` fallback again. |
| AWS CloudFront, your Terraform | Foil deploys nothing. Set the module's `any_origin` input to match the setting and run `terraform apply`. |
| Custom proxy | Foil deploys nothing. Select **Reveal proxy config** again and update your edge with the new configuration. |

When you turn the setting on, update the publishable key's allowed origins first, so the new domains can start sessions.

## Rotate the proxy credential

The proxy credential authenticates your edge to Foil. To rotate it on an installed integration, select **Rotate** under **Proxy credential**. What happens next depends on who runs the edge:

| Deployment | After you select **Rotate** |
| - | - |
| Cloudflare or AWS CloudFront, deployed by Foil | Foil deploys the new credential to your edge and retires the old one at least an hour later. Nothing changes for visitors. |
| Cloudflare, your Worker | Select **Reveal proxy config** and set the new credential as the Worker's `FOIL_PROXY_CREDENTIAL` secret. |
| AWS CloudFront, your Terraform | Select **Reveal proxy config**, set the new credential as the module's `proxy_credential`, and run `terraform apply`. |
| Custom proxy | Select **Reveal proxy config** and deploy the new credential to your edge. |

Foil accepts both credentials until your edge sends the new one, so nothing breaks while you roll it out. You can't start another rotation, or rotate a draining integration, while one is in progress. For when the old credential on an edge you run is retired, see [Credential rotation](https://usefoil.com/docs/first-party/edge-contract.md#credential-rotation).

## Replace the Cloudflare token

To replace the token Foil uses to deploy to Cloudflare, select **Replace Cloudflare API token** under **Cloudflare token**. Foil stops using the old token once it saves the new one. Revoke the old token in Cloudflare afterward.

A CloudFront integration that Foil deploys has no stored credential to replace. Foil assumes your deployment role with the integration's external ID for each operation, so you control access through the role's trust policy.

## Update your own edge

Foil updates the edges it deploys on Cloudflare and CloudFront. When you run the edge yourself, **Edge adapter** shows the version your edge reports and whether a newer one is available.

| Deployment | How to update |
| - | - |
| Cloudflare, your Worker | Copy the updated Worker module from step 2 of the integration page and deploy your Worker. |
| AWS CloudFront, your Terraform | Set the module's `version` to the new release and run `terraform apply`. Each module release has the same version as the edge adapter it deploys. |
| Custom proxy | Update your edge to the [edge contract](https://usefoil.com/docs/first-party/edge-contract.md) at the new version. |

## Redeploy or roll back the SDK

Foil keeps each installed integration on the current SDK release, so you don't need to update anything to receive new releases. To decide yourself when a release reaches your pages, [pin a release](https://usefoil.com/docs/pin-a-release.md#pin-through-a-first-party-integration) through the integration instead. **Redeploy** and **Roll back** don't change the release a pinned page loads.

**Advanced** has two controls that you rarely need:

* **Redeploy** redeploys the edge with the current release and adapter. On an edge you run, it changes nothing on your CDN.
* **Roll back** restores the previous SDK release. Foil holds the integration on that release for 24 hours, then resumes automatic updates.

## Remove an integration

Removal happens in two stages so that sessions in progress can finish.

1. Move your pages off the integration. Point them back at `cdn.usefoil.com` or at another integration.
2. Under **Remove**, select **Start draining**. New sessions through the integration fail, and sessions already in progress keep working for 24 hours. A draining integration can't be reactivated. To use the same URL again, create a new integration after removal.
3. After 24 hours, select **Remove integration**. Keep the DNS records in place until removal finishes.
4. Delete the ownership TXT record.

What removal does depends on the deployment:

| Deployment | Removal |
| - | - |
| Cloudflare, deployed by Foil | Foil deletes its Worker route and Worker, and discards the stored API token. If you attached other routes to Foil's Worker, remove them first. |
| Cloudflare, your Worker | Foil stops accepting the integration's credential. Remove the module call and the `FOIL_PROXY_CREDENTIAL` secret from your Worker yourself. |
| AWS CloudFront, deployed by Foil | Foil removes its cache behaviors and origin from the distribution, which stops traffic, then deletes the Lambda\@Edge function. AWS takes several hours to delete a function's edge replicas, so Foil may finish deleting the function later. |
| AWS CloudFront, your Terraform | Foil stops accepting the integration's credential and removes nothing from your distribution. Remove Foil's origin and cache behaviors and run `terraform apply`. After AWS deletes the function's edge replicas, which can take several hours, remove the module and apply again. |
| Custom proxy | Foil stops accepting the integration's credential. Remove the routes from your edge yourself. |

Foil refuses to delete a Worker, function, or distribution origin whose configuration no longer identifies it as the integration's, so it never removes resources it didn't create.

## Probe zones

Coming soon. A first-party probe zone will let the [network edge probe](https://usefoil.com/docs/first-party/overview.md#network-edge-probe) run on a subdomain of your own domain, such as `probe.example.com`, instead of Foil's zone, `*.e2.usefoil.com`. Until then, **Probe zone** says that probe zones aren't available yet, and the probe runs on Foil's zone for every session with no DNS changes.

A verified probe zone will apply to every site and session in your organization, so you'll need to add `https://*.<probe zone>` to `connect-src` on every site that runs Foil, alongside `https://*.e2.usefoil.com`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.