You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: en/self-host/quick-start/docker-compose.mdx
+1-6Lines changed: 1 addition & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,11 +48,6 @@ Make sure your machine meets the following minimum system requirements.
48
48
```bash
49
49
cp .env.example .env
50
50
```
51
-
<Note>
52
-
When the frontend and backend run on different subdomains, set `COOKIE_DOMAIN` to the site's top-level domain (e.g., `example.com`) and set `NEXT_PUBLIC_COOKIE_DOMAIN` to `1` in the `.env` file.
53
-
54
-
The frontend and backend must be under the same top-level domain to share authentication cookies.
55
-
</Note>
56
51
57
52
3. Start the containers using the command that matches your Docker Compose version:
58
53
@@ -144,7 +139,7 @@ Make sure your machine meets the following minimum system requirements.
144
139
145
140
Modify the environment variable values in your local `.env` file, then restart Dify to apply the changes:
This creates a timestamped backup for easy restoration.
51
+
52
+
## Reverse Proxy Setup
53
+
54
+
### Login Session Drops with Split Frontend and Backend Subdomains
55
+
56
+
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.
57
+
58
+
Set both variables in `.env`, then restart Dify:
59
+
60
+
-**`COOKIE_DOMAIN`**: set to the shared top-level domain (e.g., `example.com`). Leading dots are optional.
61
+
-**`NEXT_PUBLIC_COOKIE_DOMAIN`**: set to `1` to enable cross-subdomain cookies on the frontend.
62
+
63
+
```bash
64
+
docker compose down
65
+
docker compose up -d
66
+
```
67
+
68
+
Cookies cannot cross top-level domains, so the frontend and backend must share the same registrable domain. For full details, see [environment variables](/en/self-host/configuration/environments).
0 commit comments