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

# FAQs

## Deployment Methods

### Install Older Version

Use the `--branch` flag to install a specific version:

```bash theme={null}
git clone https://github.com/langgenius/dify.git --branch 0.15.3
```

The rest of the setup is identical to installing the latest version.

### Install Using ZIP Archive

For network-restricted environments or when git is unavailable:

```bash theme={null}
# Download latest release
wget -O dify.zip "$(curl -s https://api.github.com/repos/langgenius/dify/releases/latest | jq -r '.zipball_url')"
unzip dify.zip && rm dify.zip
```

Alternatively, download the ZIP on another device and transfer it manually.

**To upgrade**:

```bash theme={null}
wget -O dify-latest.zip "$(curl -s https://api.github.com/repos/langgenius/dify/releases/latest | jq -r '.zipball_url')"
unzip dify-latest.zip && rm dify-latest.zip
rsync -a dify-latest/ dify/
rm -rf dify-latest/
cd dify/docker
docker compose pull
docker compose up -d
```

### Clone Fails with "Remote branch null not found"

The clone command in [Deploy Dify with Docker Compose](https://docs.dify.ai/en/self-host/deploy/quick-start/docker-compose.md) resolves the latest Dify version through the GitHub API. When that request fails (usually due to GitHub's rate limit on unauthenticated requests), `jq` outputs `null`, and git reports `fatal: Remote branch null not found in upstream origin`.

Clone with an explicit version instead. Find the latest version number on [Dify releases](https://github.com/langgenius/dify/releases), then run:

```bash theme={null}
git clone --branch <version> https://github.com/langgenius/dify.git
```

Cloning without `--branch` also works. The Compose file on `main` pins the latest released images, so you still run release builds, but the deployment files themselves (the Compose file and environment templates) track development and can drift from the tagged release.

## Backup Procedures

### Create Backup Before Upgrading

Always backup before upgrading to prevent data loss:

```bash theme={null}
cp -r dify "dify.bak.$(date +%Y%m%d%H%M%S)"
```

This creates a timestamped backup for easy restoration.

## Reverse Proxy Setup

### Login Session Drops with Split Frontend and Backend Subdomains

If you have split web and API across subdomains behind a reverse proxy (for example, `app.example.com` for the UI and `api.example.com` for the backend), authentication cookies cannot reach both hosts. Login appears to succeed, but the session is dropped on the next request.

Set both variables in `.env`, then restart Dify:

* **`COOKIE_DOMAIN`**: set to the shared top-level domain (e.g., `example.com`). Leading dots are optional.
* **`NEXT_PUBLIC_COOKIE_DOMAIN`**: set to `1` to enable cross-subdomain cookies on the frontend.

```bash theme={null}
docker compose down
docker compose up -d
```

Cookies cannot cross top-level domains, so the frontend and backend must share the same registrable domain. For full details, see [environment variables](https://docs.dify.ai/en/self-host/deploy/configuration/environments.md).

### Sign-In Emails Blocked for Everyone Behind Cloudflare or Another Proxy

Everyone is refused sign-in codes and password-reset emails at once: "Too many emails have been sent from this IP address recently. Please try again later." From 1.18.0, this can happen on any deployment with Cloudflare, a load balancer, or another proxy in front of the bundled Nginx.

Dify takes each visitor's IP address from the bundled Nginx. Behind a proxy, Nginx sees only the proxy's address, so all your visitors share its limits.

If your proxy forwards straight to the `api` and `web` containers and bypasses the bundled Nginx, as some Cloudflare Tunnel and Nginx Proxy Manager setups do, skip the steps below. Instead, make sure that:

* Your proxy sets `X-Forwarded-For`. Otherwise every visitor appears with the proxy's address.
* The API is reachable only through your proxy. Anyone who can reach it directly can choose the address Dify sees.

If your proxy forwards to the bundled Nginx, tell Nginx which proxy to trust:

**1. Find Your Proxy's Address**

Each line of the Nginx access log (`docker compose logs nginx`) starts with the address your proxy connects from. Take it from the log even for a proxy on the same server, rather than assuming `127.0.0.1`.

For Cloudflare connecting directly to Nginx, skip this step.

**2. Create real-ip.conf**

Create `docker/nginx/conf.d/real-ip.conf` for your setup. Nginx already loads every `.conf` file in that directory, and upgrades leave yours in place.

> [tab] Load Balancer or Reverse Proxy
>
> For a proxy that sets `X-Forwarded-For`:
>
> ```nginx theme={null}
> # Replace with the address or CIDR range your proxy connects from.
> set_real_ip_from 192.0.2.10/32;
> real_ip_header X-Forwarded-For;
> real_ip_recursive on;
> ```

> [tab] Cloudflare
>
> For Cloudflare connecting directly to Nginx, trust each of [Cloudflare's IP ranges](https://www.cloudflare.com/ips/):
>
> ```nginx theme={null}
> # One line for each IPv4 and IPv6 range Cloudflare lists.
> set_real_ip_from <cloudflare-range>;
> # ...
> real_ip_header CF-Connecting-IP;
> ```
>
> Those ranges identify Cloudflare's network, not your zone, so also [restrict who can reach your origin](https://developers.cloudflare.com/fundamentals/security/protect-your-origin-server/). Use zone-level or per-hostname Authenticated Origin Pulls with your own certificate, or connect the origin through Cloudflare Tunnel.

> [tab] More Than One Proxy
>
> For a chain such as Cloudflare and then a proxy on your own server, trust every proxy in it: your server's proxy and each of [Cloudflare's IP ranges](https://www.cloudflare.com/ips/). If you trust only the nearest proxy, Dify sees Cloudflare's addresses instead of your visitors'.
>
> ```nginx theme={null}
> # Replace with the address your server's proxy connects from.
> set_real_ip_from 192.0.2.10/32;
> # One line for each IPv4 and IPv6 range Cloudflare lists.
> set_real_ip_from <cloudflare-range>;
> # ...
> real_ip_header X-Forwarded-For;
> real_ip_recursive on;
> ```
>
> Each proxy in the chain must append to `X-Forwarded-For`.

> [!WARNING]
>
> Never trust `0.0.0.0/0`, `::/0`, or a network that untrusted machines share. Anyone who can reach Nginx could then choose the IP address Dify sees.

**3. Reload Nginx**

```bash theme={null}
docker compose exec nginx nginx -s reload
```

New lines in `docker compose logs nginx` should now start with visitors' own addresses instead of the proxy's. Visitors no longer share the blocked address, so they can request emails again right away.


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