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: docs/docs/Deployment/deployment-multi-worker.mdx
+11Lines changed: 11 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -273,6 +273,17 @@ See [Troubleshoot multi-worker deployments](./troubleshoot#multi-worker-deployme
273
273
|`LANGFLOW_REDIS_QUEUE_POLLING_WATCHDOG_INTERVAL_S`|`15.0`| How often in seconds the watchdog scans for stale jobs. Lower values reclaim resources faster at the cost of more Redis reads. |
274
274
|`LANGFLOW_GUNICORN_PRELOAD`|`False`|**Experimental.** Loads the app in the Gunicorn master process before workers fork, reducing per-worker startup overhead. Pairs well with `LANGFLOW_WORKERS`. Non-Windows only. |
275
275
276
+
:::note
277
+
Rate limit counters are stored _per-process_ by default.
278
+
To share counters across all workers, point `LANGFLOW_RATE_LIMIT_STORAGE_URI` at the same Redis instance:
For more information, see [Login rate limiting](/api-keys-and-authentication#login-rate-limiting).
285
+
:::
286
+
276
287
## Monitor the job queue
277
288
278
289
The `GET /monitor/job_queue` endpoint returns a metrics snapshot for the running worker. It requires superuser authentication and returns HTTP 403 otherwise.
Copy file name to clipboardExpand all lines: docs/docs/Develop/api-keys-and-authentication.mdx
+221-4Lines changed: 221 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,9 @@ import Tabs from '@theme/Tabs';
7
7
importTabItemfrom'@theme/TabItem';
8
8
importIconfrom"@site/src/components/icon";
9
9
10
+
This page documents Langflow's built-in authentication, including user accounts, Langflow API keys, and the environment variables that control access to your server.
11
+
To connect Langflow to an external identity provider or SSO system, see [SSO and external authentication](./external-authentication).
12
+
10
13
:::warning
11
14
Never expose Langflow ports directly to the internet without proper security measures.
12
15
Set `LANGFLOW_AUTO_LOGIN=False`, use a non-default `LANGFLOW_SECRET_KEY`, and deploy your Langflow server behind a reverse proxy with authentication enabled.
@@ -150,7 +153,7 @@ This section describes the available authentication configuration variables.
150
153
151
154
You can use the [`.env.example`](https://github.com/langflow-ai/langflow/blob/main/.env.example) file in the Langflow repository as a template for your own `.env` file.
152
155
153
-
For JWT authentication configuration, including algorithm selection and key management, see [JWT authentication](/jwt-authentication).
156
+
For JWT token signing configuration, including algorithm selection and key management, see [Configure JWT token signing](#configure-jwt-token-signing).
154
157
155
158
### LANGFLOW_AUTO_LOGIN {#langflow-auto-login}
156
159
@@ -212,7 +215,7 @@ These defaults don't apply when using the Langflow CLI command [`langflow superu
212
215
213
216
This environment variable stores a secret key used for encrypting sensitive data like API keys and for JWT signing when using the HS256 algorithm.
214
217
Langflow uses the [Fernet](https://pypi.org/project/cryptography/) library for secret key encryption.
215
-
For JWT-specific configuration, see [JWT authentication](/jwt-authentication).
218
+
For JWT-specific configuration, see [Configure JWT token signing](#configure-jwt-token-signing).
216
219
217
220
If no secret key is provided, Langflow automatically generates one.
This variable controls how Langflow validates API keys.
@@ -457,19 +472,21 @@ SSRF protection prevents requests to internal or private network resources, such
457
472
458
473
| Variable | Format | Default | Description |
459
474
|----------|--------|---------|-------------|
460
-
| `LANGFLOW_SSRF_PROTECTION_ENABLED` | Boolean | `False` | Enable SSRF protection for the **API Request** component. When enabled, the component blocks requests to private IP addresses. When disabled, requests are not blocked. |
475
+
| `LANGFLOW_SSRF_PROTECTION_ENABLED` | Boolean | `True` | Enable SSRF protection for the **API Request** component. When enabled, the component blocks requests to private IP addresses. When disabled, requests are not blocked. |
461
476
| `LANGFLOW_SSRF_ALLOWED_HOSTS` | List[String] | Not set | A comma-separated list of allowed hosts, IP addresses, or CIDR ranges that can bypass SSRF protection checks. For example: `192.168.1.0/24,10.0.0.5,*.internal.company.local`.|
462
477
463
478
### Login rate limiting {#login-rate-limiting}
464
479
465
-
The following environment variables configure IP-based rate limiting on the `/login` endpoint to protect against brute-force attacks.
480
+
The following environment variables configure IP-based rate limiting to protect against brute-force attacks on the `/login` endpoint and abuse of public flow endpoints.
466
481
When the limit is exceeded, Langflow returns HTTP 429 with a `Retry-After: 60` header.
467
482
468
483
| Variable | Format | Default | Description |
469
484
|----------|--------|---------|-------------|
485
+
| `LANGFLOW_RATE_LIMIT_ENABLED` | Boolean | `True` | Enable rate limiting globally. Set to `False` to disable all rate limiting (not recommended in production). |
470
486
| `LANGFLOW_RATE_LIMIT_PER_MINUTE` | Integer | `5` | Maximum number of login attempts allowed per minute from a single IP address. |
471
487
| `LANGFLOW_RATE_LIMIT_STORAGE_URI` | String | `memory://` | Storage backend for rate limit counters. Use `memory://` for single-server deployments or `redis://host:port` for multi-server deployments where the limit should be shared across instances. |
472
488
| `LANGFLOW_RATE_LIMIT_TRUST_PROXY` | Boolean | `False` | When `true`, Langflow reads the client IP from the rightmost `X-Forwarded-For` header entry instead of the direct connection IP. Enable only when Langflow is behind a trusted reverse proxy or load balancer. Do not enable if users can reach Langflow directly, as this allows header spoofing. |
489
+
| `LANGFLOW_PUBLIC_FLOW_RATE_LIMIT_PER_MINUTE` | Integer | `20` | Maximum number of unauthenticated public-flow runs allowed per minute from a single IP address. Public flows run as the flow owner and consume resources, so anonymous callers are rate-limited separately from the `/login` endpoint. |
@@ -485,6 +502,206 @@ To allow webhooks to run without authentication (not recommended; use only in tr
485
502
486
503
When webhook authentication is enabled, you must provide a Langflow API key with each webhook request as an HTTP header or query parameter. For more information, see [Require authentication for webhooks](/webhook#require-authentication-for-webhooks).
Langflow issues short-lived JSON Web Tokens (JWTs) when a user logs in. The default HS256 algorithm works for most deployments. Switch to RS256 or RS512 for production deployments that require asymmetric keys or need to share the public key with other services.
508
+
509
+
<details closed>
510
+
<summary>About the JWT structure and contents</summary>
511
+
512
+
When a user logs in at the `/api/v1/login` endpoint, Langflow validates the credentials and creates a JWT containing the user's identity and expiration time. This token is then used for subsequent API requests instead of sending credentials with each request.
513
+
514
+
A JWT consists of three parts separated by dots (`.`):
* The header contains the token type and signing algorithm.
521
+
* The payload contains _claims_ — token data for user information and expiration time.
522
+
* The signature ensures the token hasn't been tampered with.
523
+
524
+
Each part of the JWT is Base64URL-encoded. You can paste this example JWT to decode the actual JSON data at [jwt.io](https://jwt.io/).
525
+
526
+
</details>
527
+
528
+
The following environment variables control JWT signing. `LANGFLOW_SECRET_KEY` is also used for data encryption and is documented separately in [`LANGFLOW_SECRET_KEY`](#langflow-secret-key).
HS256 is the default JWT algorithm, suitable for single-server deployments.
541
+
Langflow automatically generates and persists a secret key via `LANGFLOW_SECRET_KEY`.
542
+
No configuration is necessary beyond what is already covered in the [`LANGFLOW_SECRET_KEY`](#langflow-secret-key) section above.
543
+
544
+
To explicitly set the algorithm in your `.env`:
545
+
546
+
```bash
547
+
LANGFLOW_ALGORITHM=HS256
548
+
LANGFLOW_SECRET_KEY="your-custom-secret-key"
549
+
```
550
+
551
+
### RS256
552
+
553
+
RS256 uses an RSA private/public key pair. The private key signs tokens; the public key verifies them. Use RS256 for production deployments or multi-instance setups where you want to share the public key with other services.
554
+
555
+
To automatically generate a key pair, set the algorithm and Langflow creates and persists the keys in [`LANGFLOW_CONFIG_DIR`](/logging) on startup:
556
+
557
+
```bash
558
+
LANGFLOW_ALGORITHM=RS256
559
+
```
560
+
561
+
To supply your own private key (public key is derived automatically):
RS512 uses the same RSA key format as RS256 but with SHA-512 hashing for greater cryptographic strength. Key generation and configuration follow the same pattern as RS256 — substitute `RS512` for `RS256` in all the examples above.
597
+
598
+
### Configure Docker and Kubernetes deployments
599
+
600
+
**Docker with HS256** — for single-server or development deployments:
601
+
602
+
```yaml
603
+
services:
604
+
langflow:
605
+
image: langflowai/langflow:latest
606
+
environment:
607
+
- LANGFLOW_ALGORITHM=HS256
608
+
- LANGFLOW_SECRET_KEY=${LANGFLOW_SECRET_KEY}
609
+
volumes:
610
+
- langflow_data:/app/langflow
611
+
volumes:
612
+
langflow_data:
613
+
```
614
+
615
+
**Docker with RS256** — auto-generated keys (persisted in the volume):
616
+
617
+
```yaml
618
+
services:
619
+
langflow:
620
+
image: langflowai/langflow:latest
621
+
environment:
622
+
- LANGFLOW_ALGORITHM=RS256
623
+
volumes:
624
+
- langflow_data:/app/langflow
625
+
volumes:
626
+
langflow_data:
627
+
```
628
+
629
+
**Docker with RS256** — mount an existing key pair:
LANGFLOW_REFRESH_TOKEN_EXPIRE_SECONDS=604800 # 7 days
703
+
```
704
+
488
705
## Start a Langflow server with authentication enabled
489
706
490
707
This section shows you how to use the [authentication environment variables](/api-keys-and-authentication#authentication-environment-variables) to deploy a Langflow server with authentication enabled.
Langflow uses *authentication* to verify who a user is before granting access, and *authorization* to control what an authenticated user is allowed to do.
7
+
8
+
Authentication and authorization are configured independently. Most deployments only require authentication. Authorization is an optional plugin that adds role-based access control (RBAC) to your server.
9
+
10
+
To configure authentication and authorization for your Langflow server, pick your authentication path below and follow the corresponding documentation.
11
+
12
+
* To secure a Langflow server with user accounts and API keys using Langflow's built-in authentication, see [API keys and authentication](./api-keys-and-authentication).
13
+
Built-in authentication is always available and is the default setting. Users log in with a username and password, and Langflow issues a short-lived JWT session token and validates Langflow API keys against its own database.
14
+
15
+
* To connect Langflow to your company's SSO, OIDC, or identify provider, see [SSO and external authentication](./external-authentication).
16
+
External authentication lets an upstream identity provider, OIDC proxy, or corporate SSO gateway handle login. Langflow accepts the token the proxy forwards, validates it against the identity provider's JWKS endpoint, and provisions a local user automatically.
17
+
18
+
* To configure RBAC on your Langflow server, see [Authorization](./authorization).
19
+
After a user is authenticated by any of the authentication paths, the authorization layer decides what the user can do.
20
+
RBAC enforcement requires a registered authorization plugin.
21
+
22
+
When multiple credentials are present, Langflow tries each credential in the order of built-in JWT, external token, and then Langflow API key.
0 commit comments